Skip to content

Commit

Permalink
Rename chip-response to make it clearer what it actually does.
Browse files Browse the repository at this point in the history
Right now it supports sending unicast messages.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Oct 28, 2020
1 parent 29d3c3e commit 49f05f5
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ efr32_executable("lighting_app") {
"${chip_root}/src/app/util/attribute-storage.c",
"${chip_root}/src/app/util/attribute-table.c",
"${chip_root}/src/app/util/binding-table.cpp",
"${chip_root}/src/app/util/chip-response.cpp",
"${chip_root}/src/app/util/chip-message-send.cpp",
"${chip_root}/src/app/util/client-api.c",
"${chip_root}/src/app/util/ember-print.cpp",
"${chip_root}/src/app/util/message.c",
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/lighting-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ source_set("lighting-common") {
"${chip_root}/src/app/util/attribute-storage.c",
"${chip_root}/src/app/util/attribute-table.c",
"${chip_root}/src/app/util/binding-table.cpp",
"${chip_root}/src/app/util/chip-response.cpp",
"${chip_root}/src/app/util/chip-message-send.cpp",
"${chip_root}/src/app/util/client-api.c",
"${chip_root}/src/app/util/ember-print.cpp",
"${chip_root}/src/app/util/message.c",
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ target_sources(app PRIVATE
${CHIP_ROOT}/src/app/util/attribute-storage.c
${CHIP_ROOT}/src/app/util/attribute-table.c
${CHIP_ROOT}/src/app/util/binding-table.cpp
${CHIP_ROOT}/src/app/util/chip-response.cpp
${CHIP_ROOT}/src/app/util/chip-message-send.cpp
${CHIP_ROOT}/src/app/util/client-api.c
${CHIP_ROOT}/src/app/util/ember-print.cpp
${CHIP_ROOT}/src/app/util/message.c
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ efr32_executable("lock_app") {
"${chip_root}/src/app/util/attribute-storage.c",
"${chip_root}/src/app/util/attribute-table.c",
"${chip_root}/src/app/util/binding-table.cpp",
"${chip_root}/src/app/util/chip-response.cpp",
"${chip_root}/src/app/util/chip-message-send.cpp",
"${chip_root}/src/app/util/client-api.c",
"${chip_root}/src/app/util/ember-print.cpp",
"${chip_root}/src/app/util/message.c",
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/k32w/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SRCS = \
$(CHIP_ROOT)/src/app/util/attribute-size.c \
$(CHIP_ROOT)/src/app/util/attribute-storage.c \
$(CHIP_ROOT)/src/app/util/attribute-table.c \
$(CHIP_ROOT)/src/app/util/chip-response.cpp \
$(CHIP_ROOT)/src/app/util/chip-message-send.cpp \
$(CHIP_ROOT)/src/app/util/client-api.c \
$(CHIP_ROOT)/src/app/util/ember-print.cpp \
$(CHIP_ROOT)/src/app/util/message.c \
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/lock-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ source_set("lock-common") {
"${chip_root}/src/app/util/attribute-storage.c",
"${chip_root}/src/app/util/attribute-table.c",
"${chip_root}/src/app/util/binding-table.cpp",
"${chip_root}/src/app/util/chip-response.cpp",
"${chip_root}/src/app/util/chip-message-send.cpp",
"${chip_root}/src/app/util/client-api.c",
"${chip_root}/src/app/util/ember-print.cpp",
"${chip_root}/src/app/util/message.c",
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ target_sources(app PRIVATE
${CHIP_ROOT}/src/app/util/attribute-storage.c
${CHIP_ROOT}/src/app/util/attribute-table.c
${CHIP_ROOT}/src/app/util/binding-table.cpp
${CHIP_ROOT}/src/app/util/chip-response.cpp
${CHIP_ROOT}/src/app/util/chip-message-send.cpp
${CHIP_ROOT}/src/app/util/client-api.c
${CHIP_ROOT}/src/app/util/ember-print.cpp
${CHIP_ROOT}/src/app/util/message.c
Expand Down
4 changes: 2 additions & 2 deletions src/app/util/af-main-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
#include "gen/callback.h"
//#include "print.h"
#include "binding-table.h"
#include "chip-response.h"
#include "chip-message-send.h"
#include "util.h"

// Querying the Ember Stack for what libraries are present.
Expand Down Expand Up @@ -688,7 +688,7 @@ EmberStatus emAfSend(EmberOutgoingMessageType type, uint64_t indexOrDestination,
status = EMBER_ERR_FATAL;
break;
case EMBER_OUTGOING_DIRECT:
status = chipSendResponse(indexOrDestination, apsFrame, messageLength, message);
status = chipSendUnicast(indexOrDestination, apsFrame, messageLength, message);
break;
case EMBER_OUTGOING_MULTICAST:
// No implementation yet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

/**
* @file
* This file provides an implementation of chipSendResponse.
* This file provides an implementation of functions for sending messages.
*/

#include "chip-response.h"
#include "chip-message-send.h"

#include <assert.h>
#include <inet/InetLayer.h> // PacketBuffer and the like
Expand All @@ -40,7 +40,7 @@ extern SecureSessionMgrBase & SessionManager();

extern "C" {

EmberStatus chipSendResponse(NodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message)
EmberStatus chipSendUnicast(NodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message)
{
uint16_t frameSize = encodeApsFrame(nullptr, 0, apsFrame);
uint32_t dataLength = uint32_t(frameSize) + uint32_t(messageLength);
Expand Down
18 changes: 8 additions & 10 deletions src/app/util/chip-response.h → src/app/util/chip-message-send.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@

/**
* @file
* This file declares a function that can be called to send a response (in the
* form of a buffer and length) to a given response destination node id.
* This file declares a function that can be called to send a unicast message
* (in the form of a buffer and length) to a given response destination node
* id.
*/

#ifndef CHIP_RESPONSE_H
#define CHIP_RESPONSE_H
#pragma once

#include "types_stub.h" // For EmberApsFrame, EmberStatus, node ids.

/**
* @brief
* Called to send a response to a message. The message is constructed
* Called to send a unicast message. The message is constructed
* by serializing the given APS frame followed by the actual message
* buffer passed in.
*
* @param[in] destination The destination node id to send the response to.
* @param[in] apsFrame The APS frame to use for the response.
* @param[in] destination The destination node id to send the message to.
* @param[in] apsFrame The APS frame to use for the message.
* @param[in] messageLength The length of the message to send after the APS
* frame.
* @param[in] message The message to send after the APS frame.
Expand All @@ -42,10 +42,8 @@
extern "C" {
#endif // __cplusplus

EmberStatus chipSendResponse(ChipNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message);
EmberStatus chipSendUnicast(ChipNodeId destination, EmberApsFrame * apsFrame, uint16_t messageLength, uint8_t * message);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

#endif // CHIP_RESPONSE_H

0 comments on commit 49f05f5

Please sign in to comment.