Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / app / util / af-main.h
1 /**
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *
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
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 /**
19  *
20  *    Copyright (c) 2020 Silicon Labs
21  *
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
25  *
26  *        http://www.apache.org/licenses/LICENSE-2.0
27  *
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.
33  */
34 /***************************************************************************/
35 /**
36  * @file
37  * @brief
38  *******************************************************************************
39  ******************************************************************************/
40
41 #pragma once
42
43 #include "af-types.h"
44
45 //#include CONFIGURATION_HEADER
46 //#include PLATFORM_HEADER     // Micro and compiler specific typedefs and macros
47 //#include "stack/include/ember-types.h"
48
49 #define MFG_STRING_MAX_LENGTH 16
50
51 typedef struct
52 {
53     EmberAfMessageSentFunction callback;
54     uint8_t tag;
55 } CallbackTableEntry;
56
57 #if defined(EZSP_HOST)
58 bool emberAfMemoryByteCompare(const uint8_t * pointer, uint8_t count, uint8_t byteValue);
59 #else
60 bool emMemoryByteCompare(const uint8_t * bytes, uint8_t count, uint8_t target);
61
62 #define emberAfMemoryByteCompare(pointer, count, byteValue) emMemoryByteCompare((pointer), (count), (byteValue))
63 #endif
64
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);
68
69 // Functions common to both SOC and Host versions of the application.
70 void emAfInitializeMessageSentCallbackArray(void);
71
72 #if defined(EZSP_HOST)
73 void emAfClearNetworkCache(uint8_t networkIndex);
74 #else
75 #define emAfClearNetworkCache(index)
76 uint8_t emAfCopyMessageIntoRamBuffer(EmberMessageBuffer message, uint8_t * buffer, uint16_t bufLen);
77 #endif
78
79 #if defined EZSP_HOST
80 // utility for setting an EZSP config value and printing the result
81 EzspStatus emberAfSetEzspConfigValue(EzspConfigId configId, uint16_t value, const char * configIdName);
82
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);
86
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);
89
90 bool emberAfNcpNeedsReset(void);
91
92 #endif // EZSP_HOST
93
94 void emAfPrintStatus(const char * task, EmberStatus status);
95
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);
104
105 uint8_t emAfGetPacketBufferFreeCount(void);
106 uint8_t emAfGetPacketBufferTotalCount(void);
107
108 EmberStatus emberAfGetSourceRouteTableEntry(uint8_t index, EmberNodeId * destination, uint8_t * closerIndex);
109
110 uint8_t emberAfGetSourceRouteTableTotalSize(void);
111 uint8_t emberAfGetSourceRouteTableFilledSize(void);
112
113 EmberStatus emberAfGetChildData(uint8_t index, EmberChildData * childData);
114
115 void emAfCliVersionCommand(void);
116
117 EmberStatus emAfPermitJoin(uint8_t duration, bool broadcastMgmtPermitJoin);
118 void emAfStopSmartEnergyStartup(void);
119
120 bool emAfProcessZdo(EmberNodeId sender, EmberApsFrame * apsFrame, uint8_t * message, uint16_t length);
121
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);
128
129 void emAfStackStatusHandler(EmberStatus status);
130 void emAfNetworkInit(void);
131
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()
137 #else
138 #define EM_AF_NETWORK_INIT() emAfNetworkInit()
139 #endif
140
141 #define emberAfCopyBigEndianEui64Argument emberCopyBigEndianEui64Argument
142 void emAfScheduleFindAndRejoinEvent(void);
143
144 extern const EmberEUI64 emberAfNullEui64;
145
146 void emberAfFormatMfgString(uint8_t * mfgString);
147
148 extern bool emberAfPrintReceivedMessages;
149
150 void emAfParseAndPrintVersion(EmberVersion versionStruct);
151 void emAfPrintEzspEndpointFlags(chip::EndpointId endpoint);
152
153 // Old names
154 #define emberAfMoveInProgress() emberAfMoveInProgressCallback()
155 #define emberAfStartMove() emberAfStartMoveCallback()
156 #define emberAfStopMove() emberAfStopMoveCallback()