Код: Выделить всё
bacnetClient.Start();
BacnetAddress deviceAddress = new BacnetAddress(BacnetAddressTypes.IP, "10.20.30.250:47808");
BacnetObjectId objectId = new BacnetObjectId(BacnetObjectTypes.OBJECT_BINARY_OUTPUT, 2);
IList values;
bool success = bacnetClient.ReadPropertyRequest(deviceAddress, objectId, BacnetPropertyIds.PROP_PRESENT_VALUE, out values);
if (success)
{
string presentValue = values[0].Value.ToString();
Console.WriteLine($"Present Value: {presentValue}");
}
else
{
Console>writeLine("Error occurred while reading from the device.")
}
uint value = 1;
IList valtowrite = new BacnetValue[1] { new BacnetValue(value) };
bool successWrite = bacnetClient.WritePropertyRequest(deviceAddress, objectId, BacnetPropertyIds.PROP_PRESENT_VALUE, valtowrite );
if (successWrite)
{
Console.WriteLine($"\nSuccessfully updated the status for OBJECT_BINARY_OUTPUT 2");
bool successRead = bacnetClient.ReadPropertyRequest(deviceAddress, objectId, BacnetPropertyIds.PROP_PRESENT_VALUE, out values);
if (successRead)
{
Console.WriteLine($"\nSuccessfully updated the status for OBJECT_BINARY_OUTPUT 2");
}
else {
Console.WriteLine("\n!! Error occured when reading from BACnet device. !!");
}
}
else
{
Console.WriteLine("\n !! Error occurred while writing to the bacnet device. !!");
}
System.Exception: отказ от устройства, причина: INVALID_TAG
at System.IO.BACnet.BacnetClient.WritePropertyRequest(BacnetAddress adr, BacnetObjectId objectId, BacnetPropertyIds propertyId, IEnumerable`1 valueList, Byte ignoreId)
Я хочу записать (обновить) значение объекта BinaryOutput, чтобы изменить его статус (Активный/Неактивный)
Подробнее здесь: https://stackoverflow.com/questions/789 ... stem-io-ba