Added BACnet Zigbee Link Layer (#1052)

This commit is contained in:
Steve Karg
2025-07-28 13:06:48 -05:00
committed by GitHub
parent 85ba0b2315
commit b326563a3c
13 changed files with 497 additions and 70 deletions
+39
View File
@@ -119,6 +119,45 @@ struct vmac_data *VMAC_Find_By_Key(uint32_t device_id)
return Keylist_Data(VMAC_List, device_id);
}
/**
* Finds a VMAC in the list by seeking the list index
*
* @param index - Index that shall be returned
* @param device_id - BACnet device object instance number
*
* @return true if the device_id and vmac are found
*/
bool VMAC_Entry_By_Index(int index, uint32_t *device_id, struct vmac_data *vmac)
{
bool status = false;
struct vmac_data *data;
KEY key = 0;
uint8_t i;
data = Keylist_Data_Index(VMAC_List, index);
if (data) {
/* virtual MAC is the Device ID */
status = Keylist_Index_Key(VMAC_List, index, &key);
if (status) {
if (device_id) {
*device_id = key;
}
if (vmac) {
for (i = 0; i < sizeof(vmac->mac); i++) {
if (i < data->mac_len) {
vmac->mac[i] = data->mac[i];
} else {
break;
}
}
vmac->mac_len = data->mac_len;
}
}
}
return status;
}
/** Compare the VMAC address
*
* @param vmac1 - VMAC address that will be compared to vmac2
+3
View File
@@ -35,6 +35,9 @@ unsigned int VMAC_Count(void);
BACNET_STACK_EXPORT
struct vmac_data *VMAC_Find_By_Key(uint32_t device_id);
BACNET_STACK_EXPORT
bool VMAC_Entry_By_Index(
int index, uint32_t *device_id, struct vmac_data *vmac);
BACNET_STACK_EXPORT
bool VMAC_Find_By_Data(const struct vmac_data *vmac, uint32_t *device_id);
BACNET_STACK_EXPORT
bool VMAC_Add(uint32_t device_id, const struct vmac_data *pVMAC);