-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new on/off cluster implementation based on the Silicon Labs ZigbeePro code #1609
Changes from all commits
44fbe1e
695f3ff
8745ea0
c0750c4
3248312
2d08c99
857e4f6
3053241
76aa9b0
b847240
9c79b6c
b83d489
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
/** | ||
* | ||
* Copyright (c) 2020 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this supposed to be dual copyright, since SiLabs is already a CHIP Author? Question applies throughout IANAL |
||
* | ||
* Copyright (c) 2020 Silicon Labs | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/***************************************************************************/ | ||
/** | ||
* @file | ||
* @brief | ||
******************************************************************************* | ||
******************************************************************************/ | ||
|
||
#ifndef SILABS_AF_MAIN_H | ||
#define SILABS_AF_MAIN_H | ||
|
||
#include "af-types.h" | ||
|
||
//#include CONFIGURATION_HEADER | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove commented out code? This commented out include seems to occur in other places as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I mentioned above, the goal is to land something with as few differences from the original SiLabs code as possible, subject to the "it compiles and runs" constraint. Once this lands, we will definitely be doing a bunch of cleanup, which will include removing the commented-out bits here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I filed #1611 on this. |
||
//#include PLATFORM_HEADER // Micro and compiler specific typedefs and macros | ||
//#include "stack/include/ember-types.h" | ||
|
||
#define MFG_STRING_MAX_LENGTH 16 | ||
|
||
typedef struct | ||
{ | ||
EmberAfMessageSentFunction callback; | ||
uint8_t tag; | ||
} CallbackTableEntry; | ||
|
||
#if defined(EZSP_HOST) | ||
bool emberAfMemoryByteCompare(const uint8_t * pointer, uint8_t count, uint8_t byteValue); | ||
#else | ||
bool emMemoryByteCompare(const uint8_t * bytes, uint8_t count, uint8_t target); | ||
|
||
#define emberAfMemoryByteCompare(pointer, count, byteValue) emMemoryByteCompare((pointer), (count), (byteValue)) | ||
#endif | ||
|
||
// returnData must be MFG_STRING_MAX_LENGTH in length and | ||
// is NOT expected to be NULL terminated (could be though) | ||
void emberAfGetMfgString(uint8_t * returnData); | ||
|
||
// Functions common to both SOC and Host versions of the application. | ||
void emAfInitializeMessageSentCallbackArray(void); | ||
|
||
EmberAfCbkeKeyEstablishmentSuite emberAfIsFullSmartEnergySecurityPresent(void); | ||
|
||
#if defined(EZSP_HOST) | ||
void emAfClearNetworkCache(uint8_t networkIndex); | ||
#else | ||
#define emAfClearNetworkCache(index) | ||
uint8_t emAfCopyMessageIntoRamBuffer(EmberMessageBuffer message, uint8_t * buffer, uint16_t bufLen); | ||
#endif | ||
|
||
#if defined EZSP_HOST | ||
// utility for setting an EZSP config value and printing the result | ||
EzspStatus emberAfSetEzspConfigValue(EzspConfigId configId, uint16_t value, const char * configIdName); | ||
|
||
// utility for setting an EZSP policy and printing the result | ||
EzspStatus emberAfSetEzspPolicy(EzspPolicyId policyId, EzspDecisionId decisionId, const char * policyName, | ||
const char * decisionName); | ||
|
||
// utility for setting an EZSP value and printing the result | ||
EzspStatus emberAfSetEzspValue(EzspValueId valueId, uint8_t valueLength, uint8_t * value, const char * valueName); | ||
|
||
bool emberAfNcpNeedsReset(void); | ||
|
||
#endif // EZSP_HOST | ||
|
||
void emAfPrintStatus(const char * task, EmberStatus status); | ||
|
||
uint8_t emberAfGetSecurityLevel(void); | ||
uint8_t emberAfGetKeyTableSize(void); | ||
uint8_t emberAfGetBindingTableSize(void); | ||
uint8_t emberAfGetAddressTableSize(void); | ||
uint8_t emberAfGetChildTableSize(void); | ||
uint8_t emberAfGetRouteTableSize(void); | ||
uint8_t emberAfGetNeighborTableSize(void); | ||
uint8_t emberAfGetStackProfile(void); | ||
uint8_t emberAfGetSleepyMulticastConfig(void); | ||
|
||
uint8_t emAfGetPacketBufferFreeCount(void); | ||
uint8_t emAfGetPacketBufferTotalCount(void); | ||
|
||
EmberStatus emberAfGetSourceRouteTableEntry(uint8_t index, EmberNodeId * destination, uint8_t * closerIndex); | ||
|
||
uint8_t emberAfGetSourceRouteTableTotalSize(void); | ||
uint8_t emberAfGetSourceRouteTableFilledSize(void); | ||
|
||
EmberStatus emberAfGetChildData(uint8_t index, EmberChildData * childData); | ||
|
||
void emAfCliVersionCommand(void); | ||
|
||
EmberStatus emAfPermitJoin(uint8_t duration, bool broadcastMgmtPermitJoin); | ||
void emAfStopSmartEnergyStartup(void); | ||
|
||
bool emAfProcessZdo(EmberNodeId sender, EmberApsFrame * apsFrame, uint8_t * message, uint16_t length); | ||
|
||
void emAfIncomingMessageHandler(EmberIncomingMessageType type, EmberApsFrame * apsFrame, uint8_t lastHopLqi, int8_t lastHopRssi, | ||
uint16_t messageLength, uint8_t * messageContents); | ||
EmberStatus emAfSend(EmberOutgoingMessageType type, uint16_t indexOrDestination, EmberApsFrame * apsFrame, uint8_t messageLength, | ||
uint8_t * message, uint8_t * messageTag, EmberNodeId alias, uint8_t sequence); | ||
void emAfMessageSentHandler(EmberOutgoingMessageType type, uint16_t indexOrDestination, EmberApsFrame * apsFrame, | ||
EmberStatus status, uint16_t messageLength, uint8_t * messageContents, uint8_t messageTag); | ||
|
||
void emAfStackStatusHandler(EmberStatus status); | ||
void emAfNetworkInit(void); | ||
|
||
// For testing purposes only, we suppress the normal call to emberNetworkInit() | ||
// at reboot. This allows us to call it manually later and prevent the node | ||
// from immediately coming back up on the network after reboot. | ||
#ifdef EMBER_AF_TC_SWAP_OUT_TEST | ||
#define EM_AF_NETWORK_INIT() | ||
#else | ||
#define EM_AF_NETWORK_INIT() emAfNetworkInit() | ||
#endif | ||
|
||
#define emberAfCopyBigEndianEui64Argument emberCopyBigEndianEui64Argument | ||
void emAfScheduleFindAndRejoinEvent(void); | ||
|
||
extern const EmberEUI64 emberAfNullEui64; | ||
|
||
void emberAfFormatMfgString(uint8_t * mfgString); | ||
|
||
extern bool emberAfPrintReceivedMessages; | ||
|
||
void emAfParseAndPrintVersion(EmberVersion versionStruct); | ||
void emAfPrintEzspEndpointFlags(uint8_t endpoint); | ||
|
||
// Old names | ||
#define emberAfMoveInProgress() emberAfMoveInProgressCallback() | ||
#define emberAfStartMove() emberAfStartMoveCallback() | ||
#define emberAfStopMove() emberAfStopMoveCallback() | ||
|
||
#endif // SILABS_AF_MAIN_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these files common or intended to be generated in real apps? I suggest to move them to
common
since I did not see esp32 specific codes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files are common, but can't compile without the
gen
bits (which are app-specific) right now. See #1630.We can move them to
examples/common
if files in there can include app-specific headers (which is possible if we set up the include paths for the apps correctly).Once #1630 is fixed, we can move these files somewhere else much more easily, of course.