Skip to content

Commit

Permalink
Added example of setting the Protocol_reversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ssmethurst committed Aug 20, 2020
1 parent e9c5eb9 commit cbc2312
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions BACnetServerExample/BACnetServerExampleDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class ExampleDatabaseDevice : ExampleDatabaseBase
public UInt32 instance;
public String modelName;
public UInt32 vendorIdentifiier;
public UInt32 protocolRevision;
public String vendorName;
}
public class ExampleDatabaseAnalog : ExampleDatabaseBase
Expand Down Expand Up @@ -177,6 +178,7 @@ public void Setup()
this.Device.instance = 389001;
this.Device.description = "This is the example description";
this.Device.vendorIdentifiier = 389; // 389 is Chipkin's vendorIdentifiier
this.Device.protocolRevision = 16; // Overide the protocolRevision
this.Device.vendorName = "Chipkin Automation Systems";
this.Device.modelName = "BACnetServerExampleCSharp";

Expand Down
11 changes: 8 additions & 3 deletions BACnetServerExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ unsafe class BACnetServer
private ExampleDatabase database = new ExampleDatabase();

// Version
const string APPLICATION_VERSION = "0.0.2";
const string APPLICATION_VERSION = "0.0.3";

// Server setup and main loop
public void Run()
Expand Down Expand Up @@ -592,7 +592,7 @@ public bool CallbackGetEnumerated(UInt32 deviceInstance, UInt16 objectType, UInt
*value = (UInt32)(database.BinaryInput[objectInstance].presentValue ? 1 : 0);
Console.WriteLine("FYI: BinaryInput[{0}].value got [{1}]", objectInstance, database.BinaryInput[objectInstance].presentValue);
return true;
}
}
}
break;
case CASBACnetStackAdapter.OBJECT_TYPE_BINARY_VALUE:
Expand Down Expand Up @@ -649,6 +649,11 @@ public bool CallbackGetUnsignedInteger(UInt32 deviceInstance, UInt16 objectType,
*value = database.Device.vendorIdentifiier;
return true;
}
else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PROTOCOLREVISION)
{
*value = database.Device.protocolRevision;
return true;
}
}
break;

Expand Down Expand Up @@ -724,7 +729,7 @@ public bool CallbackGetPropertyBool(UInt32 deviceInstance, UInt16 objectType, UI
*value = database.AnalogInput[objectInstance].outOfService;
Console.WriteLine("FYI: AnalogInput[{0}].outOfService got [{1}]", objectInstance, database.AnalogInput[objectInstance].outOfService);
return true;
}
}
}
break;
case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_OUTPUT:
Expand Down
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

## Version 0.0.x

### 0.0.2.x (2020-Jun-19)
### 0.0.3 (2020-Aug-19)

- Added example of setting the protocol revision.

### 0.0.2 (2020-Jun-19)

- Implemented help and quit functionality.

### 0.0.1.x (2020-Feb-12)
### 0.0.1 (2020-Feb-12)

- Inital release.
- Inital release

0 comments on commit cbc2312

Please sign in to comment.