Skip to content

Commit

Permalink
Convert various app/util files to C++ (#3428)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored Oct 26, 2020
1 parent 2a3d066 commit e7480cd
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 26 deletions.
8 changes: 4 additions & 4 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ efr32_executable("lighting_app") {
"${chip_root}/examples/common/chip-app-server/DataModelHandler.cpp",
"${chip_root}/src/app/clusters/on-off-server/on-off.c",
"${chip_root}/src/app/util/af-event.cpp",
"${chip_root}/src/app/util/af-main-common.c",
"${chip_root}/src/app/util/af-main-common.cpp",
"${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/binding-table.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",
"${chip_root}/src/app/util/message.cpp",
"${chip_root}/src/app/util/process-cluster-message.c",
"${chip_root}/src/app/util/process-global-message.c",
"${chip_root}/src/app/util/util.c",
"${chip_root}/src/app/util/process-global-message.cpp",
"${chip_root}/src/app/util/util.cpp",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c",
Expand Down
8 changes: 4 additions & 4 deletions examples/lighting-app/lighting-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ source_set("lighting-common") {
"${chip_root}/examples/common/chip-app-server/DataModelHandler.cpp",
"${chip_root}/src/app/clusters/on-off-server/on-off.c",
"${chip_root}/src/app/util/af-event.cpp",
"${chip_root}/src/app/util/af-main-common.c",
"${chip_root}/src/app/util/af-main-common.cpp",
"${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/binding-table.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",
"${chip_root}/src/app/util/message.cpp",
"${chip_root}/src/app/util/process-cluster-message.c",
"${chip_root}/src/app/util/process-global-message.c",
"${chip_root}/src/app/util/util.c",
"${chip_root}/src/app/util/process-global-message.cpp",
"${chip_root}/src/app/util/util.cpp",
"gen/call-command-handler.c",
"gen/callback-stub.c",
"gen/znet-bookkeeping.c",
Expand Down
8 changes: 4 additions & 4 deletions examples/lighting-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ target_sources(app PRIVATE
${CHIP_APP_SERVER}/QRCodeUtil.cpp
${CHIP_APP_SERVER}/RendezvousServer.cpp
${CHIP_ROOT}/src/app/util/af-event.cpp
${CHIP_ROOT}/src/app/util/af-main-common.c
${CHIP_ROOT}/src/app/util/af-main-common.cpp
${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/binding-table.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
${CHIP_ROOT}/src/app/util/message.cpp
${CHIP_ROOT}/src/app/util/process-cluster-message.c
${CHIP_ROOT}/src/app/util/process-global-message.c
${CHIP_ROOT}/src/app/util/util.c
${CHIP_ROOT}/src/app/util/process-global-message.cpp
${CHIP_ROOT}/src/app/util/util.cpp
${CHIP_ROOT}/src/app/clusters/on-off-server/on-off.c)
8 changes: 4 additions & 4 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ efr32_executable("lock_app") {
"${chip_root}/examples/common/chip-app-server/DataModelHandler.cpp",
"${chip_root}/src/app/clusters/on-off-server/on-off.c",
"${chip_root}/src/app/util/af-event.cpp",
"${chip_root}/src/app/util/af-main-common.c",
"${chip_root}/src/app/util/af-main-common.cpp",
"${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/binding-table.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",
"${chip_root}/src/app/util/message.cpp",
"${chip_root}/src/app/util/process-cluster-message.c",
"${chip_root}/src/app/util/process-global-message.c",
"${chip_root}/src/app/util/util.c",
"${chip_root}/src/app/util/process-global-message.cpp",
"${chip_root}/src/app/util/util.cpp",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c",
Expand Down
8 changes: 4 additions & 4 deletions examples/lock-app/lock-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ source_set("lock-common") {
"${chip_root}/examples/common/chip-app-server/DataModelHandler.cpp",
"${chip_root}/src/app/clusters/on-off-server/on-off.c",
"${chip_root}/src/app/util/af-event.cpp",
"${chip_root}/src/app/util/af-main-common.c",
"${chip_root}/src/app/util/af-main-common.cpp",
"${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/binding-table.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",
"${chip_root}/src/app/util/message.cpp",
"${chip_root}/src/app/util/process-cluster-message.c",
"${chip_root}/src/app/util/process-global-message.c",
"${chip_root}/src/app/util/util.c",
"${chip_root}/src/app/util/process-global-message.cpp",
"${chip_root}/src/app/util/util.cpp",
"gen/call-command-handler.c",
"gen/callback-stub.c",
"gen/znet-bookkeeping.c",
Expand Down
8 changes: 4 additions & 4 deletions examples/lock-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ target_sources(app PRIVATE
${CHIP_APP_SERVER}/QRCodeUtil.cpp
${CHIP_APP_SERVER}/RendezvousServer.cpp
${CHIP_ROOT}/src/app/util/af-event.cpp
${CHIP_ROOT}/src/app/util/af-main-common.c
${CHIP_ROOT}/src/app/util/af-main-common.cpp
${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/binding-table.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
${CHIP_ROOT}/src/app/util/message.cpp
${CHIP_ROOT}/src/app/util/process-cluster-message.c
${CHIP_ROOT}/src/app/util/process-global-message.c
${CHIP_ROOT}/src/app/util/util.c
${CHIP_ROOT}/src/app/util/process-global-message.cpp
${CHIP_ROOT}/src/app/util/util.cpp
${CHIP_ROOT}/src/app/clusters/on-off-server/on-off.c)
8 changes: 8 additions & 0 deletions src/app/clusters/ias-zone-client/ias-zone-client.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,18 @@ extern IasZoneDevice emberAfIasZoneClientKnownServers[];

#define UNKNOWN_ZONE_ID 0xFF

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

void emAfClearServers(void);

void emberAfPluginIasZoneClientZdoCallback(EmberNodeId emberNodeId, EmberApsFrame * apsFrame, uint8_t * message, uint16_t length);

void emberAfPluginIasZoneClientWriteAttributesResponseCallback(EmberAfClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

void emberAfPluginIasZoneClientReadAttributesResponseCallback(EmberAfClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/util/af-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ typedef struct
EmberAfMessageSentFunction callback;
EmberApsFrame * apsFrame;
uint8_t * message;
uint16_t indexOrDestination;
uint64_t indexOrDestination;
uint16_t messageLength;
EmberOutgoingMessageType type;
bool broadcast;
Expand Down
8 changes: 8 additions & 0 deletions src/app/util/attribute-table.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@

#define ZCL_NULL_ATTRIBUTE_TABLE_INDEX 0xFFFF

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

// Remote devices writing attributes of local device
EmberAfStatus emberAfWriteAttributeExternal(uint8_t endpoint, EmberAfClusterId cluster, EmberAfAttributeId attributeID,
uint8_t mask, uint16_t manufacturerCode, uint8_t * dataPtr,
Expand All @@ -68,4 +72,8 @@ EmberAfStatus emAfWriteAttribute(uint8_t endpoint, EmberAfClusterId cluster, Emb
EmberAfStatus emAfReadAttribute(uint8_t endpoint, EmberAfClusterId cluster, EmberAfAttributeId attributeID, uint8_t mask,
uint16_t manufacturerCode, uint8_t * dataPtr, uint16_t readLength, EmberAfAttributeType * dataType);

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

#endif // ZCL_UTIL_ATTRIBUTE_TABLE_H
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion src/app/util/util.c → src/app/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const EmberAfClusterName zclClusterNames[] = {
{ ZCL_NULL_CLUSTER_ID, EMBER_AF_NULL_MANUFACTURER_CODE, NULL }, // terminator
};

static const EmberAfClusterCommand staticCmd;
static const EmberAfClusterCommand staticCmd = {};
EmberAfClusterCommand curCmd;
// A pointer to the current command being processed
// This struct is allocated on the stack inside
Expand Down Expand Up @@ -112,12 +112,14 @@ uint8_t emAfExtendedPanId[EXTENDED_PAN_ID_SIZE] = {
0, 0, 0, 0, 0, 0, 0, 0,
};

extern "C" {
#ifdef EMBER_AF_GENERATED_PLUGIN_INIT_FUNCTION_DECLARATIONS
EMBER_AF_GENERATED_PLUGIN_INIT_FUNCTION_DECLARATIONS
#endif
#ifdef EMBER_AF_GENERATED_PLUGIN_TICK_FUNCTION_DECLARATIONS
EMBER_AF_GENERATED_PLUGIN_TICK_FUNCTION_DECLARATIONS
#endif
} // extern "C"

//------------------------------------------------------------------------------

Expand Down

0 comments on commit e7480cd

Please sign in to comment.