5.1.5 System Environment APIs

The main purpose of the system environment component APIs is to provide a task management mechanism that distributes execution time among stack components and the application, as well as to offer an event system.

The following table provides details about the API functions of the system environment component.

Table 5-6. System Environment APIs
Function PrototypeDescription
void SYS_SubscribeToEvent(SYS_EventId_t id, SYS_EventReceiver_t *recv)Subscribe a receiver to an event. The same receiver can be subscribed to multiple events by calling this function several times.
void SYS_UnsubscribeFromEvent(SYS_EventId_t id, SYS_EventReceiver_t *recv)Unsubscribe a receiver from an event.
void SYS_PostEvent(SYS_EventId_t id, SYS_EventData_t data)Post an event to be delivered to all subscribed receivers.
bool SYS_IsEventDeliverable(SYS_EventId_t id)Check if the event has at least one subscriber.
bool SYS_IsEventSubscriber(SYS_EventId_t id, SYS_EventReceiver_t *recv)Check if the specified receiver is subscribed to an event.
void SYS_ClearEvents (void)Clear the events.
bool SYS_MutexLock(SYS_Mutex_t *const mutex, SYS_MutexOwner_t *const owner)Makes the asynchronous request to lock the mutex.
bool SYS_MutexUnlock(SYS_Mutex_t *const mutex, SYS_MutexOwner_t *const owner)Unlocks a mutex using synchronous request.
bool SYS_IsMutexLocked(SYS_Mutex_t *const mutex, SYS_MutexOwner_t *const owner)Checks if mutex is locked.
INLINE void SYS_PostTask(SYS_TaskId_t taskId)Posts a task to the task manager, which is later processed by the task handler of the corresponding stack layer.
bool SYS_RunTask (void)This function is called by the stack or from the main() function to process tasks.
SYS_InitStatus_t SYS_SysInit (void)Initializes the MCU and the radio chip.
static uint16_t SYS_GetRandomNumber (void)

Generates a random two-byte number.

uint16_t SYS_GetNormalizedRandomNumber (uint16_t upperLimit)Generates a random two-byte number normalized by the given upper limit.
int SYS_GetRandomSequence(uint8_t *buffer, unsigned long size)Generates a sequence of random numbers and copies them into the buffer.
INLINE uint16_t SYS_Crc16Ccitt(uint16_t initValue, uint8_t byte)Calculates the CRC using the CRC-16-CCITT algorithm.
void * SYS_ByteMemcpy(void *dst, const void *src, uint16_t size)Performs the byte memory copying operation.
bool SYS_GetBitCloudRevision(uint8_t *strVersion, uint32_t *intVersion)Get the revision number as a string and int.
void SYS_Swap(uint8_t *array, uint8_t length)Performs swap bytes in an array of length.
void ZB_HpaInit(ZbHpaCpsSetCallback_t setHpaCpsCallback)Activates the High Power Amplifier (HPA) features for Zigbee on the WBZ451H Modules.