Added simpler API to get/set Network Port MSTP MAC address (#653)
This commit is contained in:
@@ -910,6 +910,59 @@ void Network_Port_Changes_Pending_Discard(uint32_t object_instance)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For a given object instance-number, gets the MS/TP Max_Master value
|
||||||
|
* Note: depends on Network_Type being set to PORT_TYPE_MSTP for this object
|
||||||
|
*
|
||||||
|
* @param object_instance - object-instance number of the object
|
||||||
|
*
|
||||||
|
* @return MS/TP Max_Master value
|
||||||
|
*/
|
||||||
|
uint8_t Network_Port_MSTP_MAC_Address(uint32_t object_instance)
|
||||||
|
{
|
||||||
|
uint8_t value = 0;
|
||||||
|
unsigned index = 0;
|
||||||
|
|
||||||
|
index = Network_Port_Instance_To_Index(object_instance);
|
||||||
|
if (index < BACNET_NETWORK_PORTS_MAX) {
|
||||||
|
if (Object_List[index].Network_Type == PORT_TYPE_MSTP) {
|
||||||
|
value = Object_List[index].Network.MSTP.MAC_Address;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For a given object instance-number, sets the MS/TP Max_Master value
|
||||||
|
* Note: depends on Network_Type being set to PORT_TYPE_MSTP for this object
|
||||||
|
*
|
||||||
|
* @param object_instance - object-instance number of the object
|
||||||
|
* @param value - MS/TP Max_Master value 0..127
|
||||||
|
*
|
||||||
|
* @return true if values are within range and property is set.
|
||||||
|
*/
|
||||||
|
bool Network_Port_MSTP_MAC_Address_Set(uint32_t object_instance, uint8_t value)
|
||||||
|
{
|
||||||
|
bool status = false;
|
||||||
|
unsigned index = 0;
|
||||||
|
|
||||||
|
index = Network_Port_Instance_To_Index(object_instance);
|
||||||
|
if (index < BACNET_NETWORK_PORTS_MAX) {
|
||||||
|
if (Object_List[index].Network_Type == PORT_TYPE_MSTP) {
|
||||||
|
if (value <= 127) {
|
||||||
|
if (Object_List[index].Network.MSTP.MAC_Address != value) {
|
||||||
|
Object_List[index].Changes_Pending = true;
|
||||||
|
}
|
||||||
|
Object_List[index].Network.MSTP.MAC_Address = value;
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a given object instance-number, gets the MS/TP Max_Master value
|
* For a given object instance-number, gets the MS/TP Max_Master value
|
||||||
* Note: depends on Network_Type being set to PORT_TYPE_MSTP for this object
|
* Note: depends on Network_Type being set to PORT_TYPE_MSTP for this object
|
||||||
|
|||||||
@@ -143,6 +143,14 @@ extern "C" {
|
|||||||
uint32_t object_instance,
|
uint32_t object_instance,
|
||||||
uint16_t value);
|
uint16_t value);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
uint8_t Network_Port_MSTP_MAC_Address(
|
||||||
|
uint32_t object_instance);
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Network_Port_MSTP_MAC_Address_Set(
|
||||||
|
uint32_t object_instance,
|
||||||
|
uint8_t value);
|
||||||
|
|
||||||
BACNET_STACK_EXPORT
|
BACNET_STACK_EXPORT
|
||||||
uint8_t Network_Port_MSTP_Max_Master(
|
uint8_t Network_Port_MSTP_Max_Master(
|
||||||
uint32_t object_instance);
|
uint32_t object_instance);
|
||||||
|
|||||||
Reference in New Issue
Block a user