3 * Copyright (c) 2020 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 * Copyright (c) 2020 Silicon Labs
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
26 * http://www.apache.org/licenses/LICENSE-2.0
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 /***************************************************************************/
38 *******************************************************************************
39 ******************************************************************************/
45 //#include CONFIGURATION_HEADER
46 //#include PLATFORM_HEADER // Micro and compiler specific typedefs and macros
47 //#include "stack/include/ember-types.h"
49 #define MFG_STRING_MAX_LENGTH 16
53 EmberAfMessageSentFunction callback;
57 #if defined(EZSP_HOST)
58 bool emberAfMemoryByteCompare(const uint8_t * pointer, uint8_t count, uint8_t byteValue);
60 bool emMemoryByteCompare(const uint8_t * bytes, uint8_t count, uint8_t target);
62 #define emberAfMemoryByteCompare(pointer, count, byteValue) emMemoryByteCompare((pointer), (count), (byteValue))
65 // returnData must be MFG_STRING_MAX_LENGTH in length and
66 // is NOT expected to be NULL terminated (could be though)
67 void emberAfGetMfgString(uint8_t * returnData);
69 // Functions common to both SOC and Host versions of the application.
70 void emAfInitializeMessageSentCallbackArray(void);
72 #if defined(EZSP_HOST)
73 void emAfClearNetworkCache(uint8_t networkIndex);
75 #define emAfClearNetworkCache(index)
76 uint8_t emAfCopyMessageIntoRamBuffer(EmberMessageBuffer message, uint8_t * buffer, uint16_t bufLen);
80 // utility for setting an EZSP config value and printing the result
81 EzspStatus emberAfSetEzspConfigValue(EzspConfigId configId, uint16_t value, const char * configIdName);
83 // utility for setting an EZSP policy and printing the result
84 EzspStatus emberAfSetEzspPolicy(EzspPolicyId policyId, EzspDecisionId decisionId, const char * policyName,
85 const char * decisionName);
87 // utility for setting an EZSP value and printing the result
88 EzspStatus emberAfSetEzspValue(EzspValueId valueId, uint8_t valueLength, uint8_t * value, const char * valueName);
90 bool emberAfNcpNeedsReset(void);
94 void emAfPrintStatus(const char * task, EmberStatus status);
96 uint8_t emberAfGetKeyTableSize(void);
97 uint8_t emberAfGetBindingTableSize(void);
98 uint8_t emberAfGetAddressTableSize(void);
99 uint8_t emberAfGetChildTableSize(void);
100 uint8_t emberAfGetRouteTableSize(void);
101 uint8_t emberAfGetNeighborTableSize(void);
102 uint8_t emberAfGetStackProfile(void);
103 uint8_t emberAfGetSleepyMulticastConfig(void);
105 uint8_t emAfGetPacketBufferFreeCount(void);
106 uint8_t emAfGetPacketBufferTotalCount(void);
108 EmberStatus emberAfGetSourceRouteTableEntry(uint8_t index, EmberNodeId * destination, uint8_t * closerIndex);
110 uint8_t emberAfGetSourceRouteTableTotalSize(void);
111 uint8_t emberAfGetSourceRouteTableFilledSize(void);
113 EmberStatus emberAfGetChildData(uint8_t index, EmberChildData * childData);
115 void emAfCliVersionCommand(void);
117 EmberStatus emAfPermitJoin(uint8_t duration, bool broadcastMgmtPermitJoin);
118 void emAfStopSmartEnergyStartup(void);
120 bool emAfProcessZdo(EmberNodeId sender, EmberApsFrame * apsFrame, uint8_t * message, uint16_t length);
122 void emAfIncomingMessageHandler(EmberIncomingMessageType type, EmberApsFrame * apsFrame, uint8_t lastHopLqi, int8_t lastHopRssi,
123 uint16_t messageLength, uint8_t * messageContents);
124 EmberStatus emAfSend(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint8_t messageLength,
125 uint8_t * message, uint8_t * messageTag, EmberNodeId alias, uint8_t sequence);
126 void emAfMessageSentHandler(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame,
127 EmberStatus status, uint16_t messageLength, uint8_t * messageContents, uint8_t messageTag);
129 void emAfStackStatusHandler(EmberStatus status);
130 void emAfNetworkInit(void);
132 // For testing purposes only, we suppress the normal call to emberNetworkInit()
133 // at reboot. This allows us to call it manually later and prevent the node
134 // from immediately coming back up on the network after reboot.
135 #ifdef EMBER_AF_TC_SWAP_OUT_TEST
136 #define EM_AF_NETWORK_INIT()
138 #define EM_AF_NETWORK_INIT() emAfNetworkInit()
141 #define emberAfCopyBigEndianEui64Argument emberCopyBigEndianEui64Argument
142 void emAfScheduleFindAndRejoinEvent(void);
144 extern const EmberEUI64 emberAfNullEui64;
146 void emberAfFormatMfgString(uint8_t * mfgString);
148 extern bool emberAfPrintReceivedMessages;
150 void emAfParseAndPrintVersion(EmberVersion versionStruct);
151 void emAfPrintEzspEndpointFlags(chip::EndpointId endpoint);
154 #define emberAfMoveInProgress() emberAfMoveInProgressCallback()
155 #define emberAfStartMove() emberAfStartMoveCallback()
156 #define emberAfStopMove() emberAfStopMoveCallback()