diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8aa6d0c..6b99d3c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,11 @@ +variables: + GIT_SUBMODULE_STRATEGY: normal + GIT_STRATEGY: fetch + GIT_DEPTH: 1 + +cache: + key: ${CI_JOB_NAME} + stages: - build @@ -10,18 +18,18 @@ Build: # Add MSBuild.exe to path - set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin # Update the CIBuildVersion.cs - - cd BACnetServerExample\BACnetServerExample - - "echo namespace BACnetServerExample{static class CIBuildVersion { public const int CIBUILDNUMBER = %CI_PIPELINE_IID%;}} > CIBuildVersion.cs" + - cd BACnetServerExample + - "echo namespace CASBACnetStack{static class CIBuildVersion { public const int CIBUILDNUMBER = %CI_PIPELINE_IID%;}} > CIBuildVersion.cs" - type CIBuildVersion.cs - - cd ..\..\ + - cd .. script: # Create the bin directory if it does not exist - - cd BACnetServerExample\BACnetServerExample + - cd BACnetServerExample # Restore any nuget or other dependencies needed for the project - - msbuild /t:Restore /p:Configuration=Release /p:Platform=AnyCPU + - msbuild /t:Restore /p:Configuration=Release /p:Platform="Any CPU" # Build and package the project in an apk for android - - msbuild /p:Configuration=Release /p:Platform=AnyCPU - - cd bin\..\ + - msbuild /p:Configuration=Release /p:Platform="Any CPU" + - cd ..\bin - dir artifacts: paths: diff --git a/.gitmodules b/.gitmodules index 14d88e9..98b5ad3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "submodules/cas-bacnet-stack"] path = submodules/cas-bacnet-stack - url = https://gitlab.com/chipkin/cas-bacnet-stack.git + url = ../../chipkin/cas-bacnet-stack.git diff --git a/BACnetServerExample/BACnetServerExample/BACnetServerExample.csproj b/BACnetServerExample/BACnetServerExample.csproj similarity index 61% rename from BACnetServerExample/BACnetServerExample/BACnetServerExample.csproj rename to BACnetServerExample/BACnetServerExample.csproj index a8418b1..446ca3b 100644 --- a/BACnetServerExample/BACnetServerExample/BACnetServerExample.csproj +++ b/BACnetServerExample/BACnetServerExample.csproj @@ -1,4 +1,4 @@ - + Exe @@ -7,12 +7,16 @@ true - ../../bin + ../bin true - ../../bin + ../bin + + + + diff --git a/BACnetServerExample/BACnetServerExample.sln b/BACnetServerExample/BACnetServerExample.sln index 0e39826..9053b43 100644 --- a/BACnetServerExample/BACnetServerExample.sln +++ b/BACnetServerExample/BACnetServerExample.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28803.156 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BACnetServerExample", "BACnetServerExample\BACnetServerExample.csproj", "{F4321B8E-C000-4712-BC0A-D9F45DB15833}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BACnetServerExample", "BACnetServerExample.csproj", "{F4321B8E-C000-4712-BC0A-D9F45DB15833}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/BACnetServerExample/BACnetServerExample/CASBACnetStackAdapter.cs b/BACnetServerExample/BACnetServerExample/CASBACnetStackAdapter.cs deleted file mode 100644 index 24190ea..0000000 --- a/BACnetServerExample/BACnetServerExample/CASBACnetStackAdapter.cs +++ /dev/null @@ -1,1400 +0,0 @@ -#define WINDOWS - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace BACnetStackDLLServerCSharpExample -{ - unsafe class CASBACnetStackAdapter - { -#if WINDOWS -#if (DEBUG) - const string BACNET_API_DLL_FILENAME = "CASBACnetStack_x64_Debug.dll"; -#else - const string BACNET_API_DLL_FILENAME = "CASBACnetStack_x64_Release.dll"; -#endif // DEBUG -#else - // Linux -#if (DEBUG) - const string BACNET_API_DLL_FILENAME = "CASBACnetStack_x64_Debug.so"; -#else - const string BACNET_API_DLL_FILENAME = "CASBACnetStack_x64_Release.so"; -#endif // DEBUG -#endif // _WINDOWS - - public const Byte NETWORK_TYPE_IP = 0; - public const Byte NETWORK_TYPE_MSTP = 1; - - #region Object types - public const UInt16 OBJECT_TYPE_ANALOG_INPUT = 0; - public const UInt16 OBJECT_TYPE_ANALOG_OUTPUT = 1; - public const UInt16 OBJECT_TYPE_ANALOG_VALUE = 2; - public const UInt16 OBJECT_TYPE_BINARY_INPUT = 3; - public const UInt16 OBJECT_TYPE_BINARY_OUTPUT = 4; - public const UInt16 OBJECT_TYPE_BINARY_VALUE = 5; - public const UInt16 OBJECT_TYPE_CALENDAR = 6; - public const UInt16 OBJECT_TYPE_COMMAND = 7; - public const UInt16 OBJECT_TYPE_DEVICE = 8; - public const UInt16 OBJECT_TYPE_EVENT_ENROLLMENT = 9; - public const UInt16 OBJECT_TYPE_FILE = 10; - public const UInt16 OBJECT_TYPE_GROUP = 11; - public const UInt16 OBJECT_TYPE_LOOP = 12; - public const UInt16 OBJECT_TYPE_MULTI_STATE_INPUT = 13; - public const UInt16 OBJECT_TYPE_MULTI_STATE_OUTPUT = 14; - public const UInt16 OBJECT_TYPE_NOTIFICATION_CLASS = 15; - public const UInt16 OBJECT_TYPE_PROGRAM = 16; - public const UInt16 OBJECT_TYPE_SCHEDULE = 17; - public const UInt16 OBJECT_TYPE_AVERAGING = 18; - public const UInt16 OBJECT_TYPE_MULTI_STATE_VALUE = 19; - public const UInt16 OBJECT_TYPE_TREND_LOG = 20; - public const UInt16 OBJECT_TYPE_LIFE_SAFETY_POINT = 21; - public const UInt16 OBJECT_TYPE_LIFE_SAFETY_ZONE = 22; - public const UInt16 OBJECT_TYPE_ACCUMULATOR = 23; - public const UInt16 OBJECT_TYPE_PULSE_CONVERTER = 24; - public const UInt16 OBJECT_TYPE_EVENT_LOG = 25; - public const UInt16 OBJECT_TYPE_GLOBAL_GROUP = 26; - public const UInt16 OBJECT_TYPE_TREND_LOG_MULTIPLE = 27; - public const UInt16 OBJECT_TYPE_LOAD_CONTROL = 28; - public const UInt16 OBJECT_TYPE_STRUCTURED_VIEW = 29; - public const UInt16 OBJECT_TYPE_ACCESS_DOOR = 30; - public const UInt16 OBJECT_TYPE_TIMER = 31; - public const UInt16 OBJECT_TYPE_ACCESS_CREDENTIAL = 32; - public const UInt16 OBJECT_TYPE_ACCESS_POINT = 33; - public const UInt16 OBJECT_TYPE_ACCESS_RIGHTS = 34; - public const UInt16 OBJECT_TYPE_ACCESS_USER = 35; - public const UInt16 OBJECT_TYPE_ACCESS_ZONE = 36; - public const UInt16 OBJECT_TYPE_CREDENTIAL_DATA_INPUT = 37; - public const UInt16 OBJECT_TYPE_NETWORK_SECURITY = 38; - public const UInt16 OBJECT_TYPE_BITSTRING_VALUE = 39; - public const UInt16 OBJECT_TYPE_CHARACTERSTRING_VALUE = 40; - public const UInt16 OBJECT_TYPE_DATEPATTERN_VALUE = 41; - public const UInt16 OBJECT_TYPE_DATE_VALUE = 42; - public const UInt16 OBJECT_TYPE_DATETIMEPATTERN_VALUE = 43; - public const UInt16 OBJECT_TYPE_DATETIME_VALUE = 44; - public const UInt16 OBJECT_TYPE_INTEGER_VALUE = 45; - public const UInt16 OBJECT_TYPE_LARGE_ANALOG_VALUE = 46; - public const UInt16 OBJECT_TYPE_OCTETSTRING_VALUE = 47; - public const UInt16 OBJECT_TYPE_POSITIVE_INTEGER_VALUE = 48; - public const UInt16 OBJECT_TYPE_TIMEPATTERN_VALUE = 49; - public const UInt16 OBJECT_TYPE_TIME_VALUE = 50; - public const UInt16 OBJECT_TYPE_NOTIFICATION_FORWARDER = 51; - public const UInt16 OBJECT_TYPE_ALERT_ENROLLMENT = 52; - public const UInt16 OBJECT_TYPE_CHANNEL = 53; - public const UInt16 OBJECT_TYPE_LIGHTING_OUTPUT = 54; - public const UInt16 OBJECT_TYPE_BINARY_LIGHTING_OUTPUT = 55; - public const UInt16 OBJECT_TYPE_NETWORK_PORT = 56; - public const UInt16 OBJECT_TYPE_ELEVATOR_GROUP = 57; - public const UInt16 OBJECT_TYPE_ESCALATOR = 58; - public const UInt16 OBJECT_TYPE_LIFT = 59; - #endregion - - #region Services - public const UInt32 SERVICE_SUBSCRIBE_COV = 5; - public const UInt32 SERVICE_CREATE_OBJECT = 10; - public const UInt32 SERVICE_DELETE_OBJECT = 11; - public const UInt32 SERVICE_READ_PROPERTY_MULTIPLE = 14; - public const UInt32 SERVICE_WRITE_PROPERTY = 15; - public const UInt32 SERVICE_WRITE_PROPERTY_MULTIPLE = 16; - public const UInt32 SERVICE_I_AM = 26; - public const UInt32 SERVICE_I_HAVE = 27; - public const UInt32 SERVICE_TIME_SYNCHRONIZATION = 32; - public const UInt32 SERVICE_UTC_TIME_SYNCHRONIZATION = 36; - #endregion - - #region Property Identifier - // BACnetPropertyIdentifier.h - public const UInt32 PROPERTY_IDENTIFIER_ABSENTEELIMIT = 244; - public const UInt32 PROPERTY_IDENTIFIER_ACCEPTEDMODES = 175; - public const UInt32 PROPERTY_IDENTIFIER_ACCESSALARMEVENTS = 245; - public const UInt32 PROPERTY_IDENTIFIER_ACCESSDOORS = 246; - public const UInt32 PROPERTY_IDENTIFIER_ACCESSEVENT = 247; - public const UInt32 PROPERTY_IDENTIFIER_ACCESSEVENTAUTHENTICATIONFACTOR = 248; - public const UInt32 PROPERTY_IDENTIFIER_ACCESSEVENTCREDENTIAL = 249; - public const UInt32 PROPERTY_IDENTIFIER_ACCESSEVENTTAG = 322; - public const UInt32 PROPERTY_IDENTIFIER_ACCESSEVENTTIME = 250; - public const UInt32 PROPERTY_IDENTIFIER_ACCESSTRANSACTIONEVENTS = 251; - public const UInt32 PROPERTY_IDENTIFIER_ACCOMPANIMENT = 252; - public const UInt32 PROPERTY_IDENTIFIER_ACCOMPANIMENTTIME = 253; - public const UInt32 PROPERTY_IDENTIFIER_ACKREQUIRED = 1; - public const UInt32 PROPERTY_IDENTIFIER_ACKEDTRANSITIONS = 0; - public const UInt32 PROPERTY_IDENTIFIER_ACTION = 2; - public const UInt32 PROPERTY_IDENTIFIER_ACTIONTEXT = 3; - public const UInt32 PROPERTY_IDENTIFIER_ACTIVATIONTIME = 254; - public const UInt32 PROPERTY_IDENTIFIER_ACTIVEAUTHENTICATIONPOLICY = 255; - public const UInt32 PROPERTY_IDENTIFIER_ACTIVECOVMULTIPLESUBSCRIPTIONS = 481; - public const UInt32 PROPERTY_IDENTIFIER_ACTIVECOVSUBSCRIPTIONS = 152; - public const UInt32 PROPERTY_IDENTIFIER_ACTIVETEXT = 4; - public const UInt32 PROPERTY_IDENTIFIER_ACTIVEVTSESSIONS = 5; - public const UInt32 PROPERTY_IDENTIFIER_ACTUALSHEDLEVEL = 212; - public const UInt32 PROPERTY_IDENTIFIER_ADJUSTVALUE = 176; - public const UInt32 PROPERTY_IDENTIFIER_ALARMVALUE = 6; - public const UInt32 PROPERTY_IDENTIFIER_ALARMVALUES = 7; - public const UInt32 PROPERTY_IDENTIFIER_ALIGNINTERVALS = 193; - public const UInt32 PROPERTY_IDENTIFIER_ALL = 8; - public const UInt32 PROPERTY_IDENTIFIER_ALLWRITESSUCCESSFUL = 9; - public const UInt32 PROPERTY_IDENTIFIER_ALLOWGROUPDELAYINHIBIT = 365; - public const UInt32 PROPERTY_IDENTIFIER_APDULENGTH = 399; - public const UInt32 PROPERTY_IDENTIFIER_APDUSEGMENTTIMEOUT = 10; - public const UInt32 PROPERTY_IDENTIFIER_APDUTIMEOUT = 11; - public const UInt32 PROPERTY_IDENTIFIER_APPLICATIONSOFTWAREVERSION = 12; - public const UInt32 PROPERTY_IDENTIFIER_ARCHIVE = 13; - public const UInt32 PROPERTY_IDENTIFIER_ASSIGNEDACCESSRIGHTS = 256; - public const UInt32 PROPERTY_IDENTIFIER_ASSIGNEDLANDINGCALLS = 447; - public const UInt32 PROPERTY_IDENTIFIER_ATTEMPTEDSAMPLES = 124; - public const UInt32 PROPERTY_IDENTIFIER_AUTHENTICATIONFACTORS = 257; - public const UInt32 PROPERTY_IDENTIFIER_AUTHENTICATIONPOLICYLIST = 258; - public const UInt32 PROPERTY_IDENTIFIER_AUTHENTICATIONPOLICYNAMES = 259; - public const UInt32 PROPERTY_IDENTIFIER_AUTHENTICATIONSTATUS = 260; - public const UInt32 PROPERTY_IDENTIFIER_AUTHORIZATIONEXEMPTIONS = 364; - public const UInt32 PROPERTY_IDENTIFIER_AUTHORIZATIONMODE = 261; - public const UInt32 PROPERTY_IDENTIFIER_AUTOSLAVEDISCOVERY = 169; - public const UInt32 PROPERTY_IDENTIFIER_AVERAGEVALUE = 125; - public const UInt32 PROPERTY_IDENTIFIER_BACKUPANDRESTORESTATE = 338; - public const UInt32 PROPERTY_IDENTIFIER_BACKUPFAILURETIMEOUT = 153; - public const UInt32 PROPERTY_IDENTIFIER_BACKUPPREPARATIONTIME = 339; - public const UInt32 PROPERTY_IDENTIFIER_BACNETIPGLOBALADDRESS = 407; - public const UInt32 PROPERTY_IDENTIFIER_BACNETIPMODE = 408; - public const UInt32 PROPERTY_IDENTIFIER_BACNETIPMULTICASTADDRESS = 409; - public const UInt32 PROPERTY_IDENTIFIER_BACNETIPNATTRAVERSAL = 410; - public const UInt32 PROPERTY_IDENTIFIER_BACNETIPUDPPORT = 412; - public const UInt32 PROPERTY_IDENTIFIER_BACNETIPV6MODE = 435; - public const UInt32 PROPERTY_IDENTIFIER_BACNETIPV6UDPPORT = 438; - public const UInt32 PROPERTY_IDENTIFIER_BACNETIPV6MULTICASTADDRESS = 440; - public const UInt32 PROPERTY_IDENTIFIER_BASEDEVICESECURITYPOLICY = 327; - public const UInt32 PROPERTY_IDENTIFIER_BBMDACCEPTFDREGISTRATIONS = 413; - public const UInt32 PROPERTY_IDENTIFIER_BBMDBROADCASTDISTRIBUTIONTABLE = 414; - public const UInt32 PROPERTY_IDENTIFIER_BBMDFOREIGNDEVICETABLE = 415; - public const UInt32 PROPERTY_IDENTIFIER_BELONGSTO = 262; - public const UInt32 PROPERTY_IDENTIFIER_BIAS = 14; - public const UInt32 PROPERTY_IDENTIFIER_BITMASK = 342; - public const UInt32 PROPERTY_IDENTIFIER_BITTEXT = 343; - public const UInt32 PROPERTY_IDENTIFIER_BLINKWARNENABLE = 373; - public const UInt32 PROPERTY_IDENTIFIER_BUFFERSIZE = 126; - public const UInt32 PROPERTY_IDENTIFIER_CARASSIGNEDDIRECTION = 448; - public const UInt32 PROPERTY_IDENTIFIER_CARDOORCOMMAND = 449; - public const UInt32 PROPERTY_IDENTIFIER_CARDOORSTATUS = 450; - public const UInt32 PROPERTY_IDENTIFIER_CARDOORTEXT = 451; - public const UInt32 PROPERTY_IDENTIFIER_CARDOORZONE = 452; - public const UInt32 PROPERTY_IDENTIFIER_CARDRIVESTATUS = 453; - public const UInt32 PROPERTY_IDENTIFIER_CARLOAD = 454; - public const UInt32 PROPERTY_IDENTIFIER_CARLOADUNITS = 455; - public const UInt32 PROPERTY_IDENTIFIER_CARMODE = 456; - public const UInt32 PROPERTY_IDENTIFIER_CARMOVINGDIRECTION = 457; - public const UInt32 PROPERTY_IDENTIFIER_CARPOSITION = 458; - public const UInt32 PROPERTY_IDENTIFIER_CHANGEOFSTATECOUNT = 15; - public const UInt32 PROPERTY_IDENTIFIER_CHANGEOFSTATETIME = 16; - public const UInt32 PROPERTY_IDENTIFIER_CHANGESPENDING = 416; - public const UInt32 PROPERTY_IDENTIFIER_CHANNELNUMBER = 366; - public const UInt32 PROPERTY_IDENTIFIER_CLIENTCOVINCREMENT = 127; - public const UInt32 PROPERTY_IDENTIFIER_COMMAND = 417; - public const UInt32 PROPERTY_IDENTIFIER_COMMANDTIMEARRAY = 430; - public const UInt32 PROPERTY_IDENTIFIER_CONFIGURATIONFILES = 154; - public const UInt32 PROPERTY_IDENTIFIER_CONTROLGROUPS = 367; - public const UInt32 PROPERTY_IDENTIFIER_CONTROLLEDVARIABLEREFERENCE = 19; - public const UInt32 PROPERTY_IDENTIFIER_CONTROLLEDVARIABLEUNITS = 20; - public const UInt32 PROPERTY_IDENTIFIER_CONTROLLEDVARIABLEVALUE = 21; - public const UInt32 PROPERTY_IDENTIFIER_COUNT = 177; - public const UInt32 PROPERTY_IDENTIFIER_COUNTBEFORECHANGE = 178; - public const UInt32 PROPERTY_IDENTIFIER_COUNTCHANGETIME = 179; - public const UInt32 PROPERTY_IDENTIFIER_COVINCREMENT = 22; - public const UInt32 PROPERTY_IDENTIFIER_COVPERIOD = 180; - public const UInt32 PROPERTY_IDENTIFIER_COVRESUBSCRIPTIONINTERVAL = 128; - public const UInt32 PROPERTY_IDENTIFIER_COVUPERIOD = 349; - public const UInt32 PROPERTY_IDENTIFIER_COVURECIPIENTS = 350; - public const UInt32 PROPERTY_IDENTIFIER_CREDENTIALDISABLE = 263; - public const UInt32 PROPERTY_IDENTIFIER_CREDENTIALSTATUS = 264; - public const UInt32 PROPERTY_IDENTIFIER_CREDENTIALS = 265; - public const UInt32 PROPERTY_IDENTIFIER_CREDENTIALSINZONE = 266; - public const UInt32 PROPERTY_IDENTIFIER_CURRENTCOMMANDPRIORITY = 431; - public const UInt32 PROPERTY_IDENTIFIER_DATABASEREVISION = 155; - public const UInt32 PROPERTY_IDENTIFIER_DATELIST = 23; - public const UInt32 PROPERTY_IDENTIFIER_DAY_LIGHT_SAVINGS_STATUS = 24; - public const UInt32 PROPERTY_IDENTIFIER_DAYSREMAINING = 267; - public const UInt32 PROPERTY_IDENTIFIER_DEADBAND = 25; - public const UInt32 PROPERTY_IDENTIFIER_DEFAULTFADETIME = 374; - public const UInt32 PROPERTY_IDENTIFIER_DEFAULTRAMPRATE = 375; - public const UInt32 PROPERTY_IDENTIFIER_DEFAULTSTEPINCREMENT = 376; - public const UInt32 PROPERTY_IDENTIFIER_DEFAULTSUBORDINATERELATIONSHIP = 490; - public const UInt32 PROPERTY_IDENTIFIER_DEFAULTTIMEOUT = 393; - public const UInt32 PROPERTY_IDENTIFIER_DEPLOYEDPROFILELOCATION = 484; - public const UInt32 PROPERTY_IDENTIFIER_DERIVATIVECONSTANT = 26; - public const UInt32 PROPERTY_IDENTIFIER_DERIVATIVECONSTANTUNITS = 27; - public const UInt32 PROPERTY_IDENTIFIER_DESCRIPTION = 28; - public const UInt32 PROPERTY_IDENTIFIER_DESCRIPTIONOFHALT = 29; - public const UInt32 PROPERTY_IDENTIFIER_DEVICEADDRESSBINDING = 30; - public const UInt32 PROPERTY_IDENTIFIER_DEVICETYPE = 31; - public const UInt32 PROPERTY_IDENTIFIER_DIRECTREADING = 156; - public const UInt32 PROPERTY_IDENTIFIER_DISTRIBUTIONKEYREVISION = 328; - public const UInt32 PROPERTY_IDENTIFIER_DONOTHIDE = 329; - public const UInt32 PROPERTY_IDENTIFIER_DOORALARMSTATE = 226; - public const UInt32 PROPERTY_IDENTIFIER_DOOREXTENDEDPULSETIME = 227; - public const UInt32 PROPERTY_IDENTIFIER_DOORMEMBERS = 228; - public const UInt32 PROPERTY_IDENTIFIER_DOOROPENTOOLONGTIME = 229; - public const UInt32 PROPERTY_IDENTIFIER_DOORPULSETIME = 230; - public const UInt32 PROPERTY_IDENTIFIER_DOORSTATUS = 231; - public const UInt32 PROPERTY_IDENTIFIER_DOORUNLOCKDELAYTIME = 232; - public const UInt32 PROPERTY_IDENTIFIER_DUTYWINDOW = 213; - public const UInt32 PROPERTY_IDENTIFIER_EFFECTIVEPERIOD = 32; - public const UInt32 PROPERTY_IDENTIFIER_EGRESSACTIVE = 386; - public const UInt32 PROPERTY_IDENTIFIER_EGRESSTIME = 377; - public const UInt32 PROPERTY_IDENTIFIER_ELAPSEDACTIVETIME = 33; - public const UInt32 PROPERTY_IDENTIFIER_ELEVATORGROUP = 459; - public const UInt32 PROPERTY_IDENTIFIER_ENABLE = 133; - public const UInt32 PROPERTY_IDENTIFIER_ENERGYMETER = 460; - public const UInt32 PROPERTY_IDENTIFIER_ENERGYMETERREF = 461; - public const UInt32 PROPERTY_IDENTIFIER_ENTRYPOINTS = 268; - public const UInt32 PROPERTY_IDENTIFIER_ERRORLIMIT = 34; - public const UInt32 PROPERTY_IDENTIFIER_ESCALATORMODE = 462; - public const UInt32 PROPERTY_IDENTIFIER_EVENTALGORITHMINHIBIT = 354; - public const UInt32 PROPERTY_IDENTIFIER_EVENTALGORITHMINHIBITREF = 355; - public const UInt32 PROPERTY_IDENTIFIER_EVENTDETECTIONENABLE = 353; - public const UInt32 PROPERTY_IDENTIFIER_EVENTENABLE = 35; - public const UInt32 PROPERTY_IDENTIFIER_EVENTMESSAGETEXTS = 351; - public const UInt32 PROPERTY_IDENTIFIER_EVENTMESSAGETEXTSCONFIG = 352; - public const UInt32 PROPERTY_IDENTIFIER_EVENTPARAMETERS = 83; - public const UInt32 PROPERTY_IDENTIFIER_EVENTSTATE = 36; - public const UInt32 PROPERTY_IDENTIFIER_EVENTTIMESTAMPS = 130; - public const UInt32 PROPERTY_IDENTIFIER_EVENTTYPE = 37; - public const UInt32 PROPERTY_IDENTIFIER_EXCEPTIONSCHEDULE = 38; - public const UInt32 PROPERTY_IDENTIFIER_EXECUTIONDELAY = 368; - public const UInt32 PROPERTY_IDENTIFIER_EXITPOINTS = 269; - public const UInt32 PROPERTY_IDENTIFIER_EXPECTEDSHEDLEVEL = 214; - public const UInt32 PROPERTY_IDENTIFIER_EXPIRATIONTIME = 270; - public const UInt32 PROPERTY_IDENTIFIER_EXTENDEDTIMEENABLE = 271; - public const UInt32 PROPERTY_IDENTIFIER_FAILEDATTEMPTEVENTS = 272; - public const UInt32 PROPERTY_IDENTIFIER_FAILEDATTEMPTS = 273; - public const UInt32 PROPERTY_IDENTIFIER_FAILEDATTEMPTSTIME = 274; - public const UInt32 PROPERTY_IDENTIFIER_FAULTHIGHLIMIT = 388; - public const UInt32 PROPERTY_IDENTIFIER_FAULTLOWLIMIT = 389; - public const UInt32 PROPERTY_IDENTIFIER_FAULTPARAMETERS = 358; - public const UInt32 PROPERTY_IDENTIFIER_FAULTSIGNALS = 463; - public const UInt32 PROPERTY_IDENTIFIER_FAULTTYPE = 359; - public const UInt32 PROPERTY_IDENTIFIER_FAULTVALUES = 39; - public const UInt32 PROPERTY_IDENTIFIER_FDBBMDADDRESS = 418; - public const UInt32 PROPERTY_IDENTIFIER_FDSUBSCRIPTIONLIFETIME = 419; - public const UInt32 PROPERTY_IDENTIFIER_FEEDBACKVALUE = 40; - public const UInt32 PROPERTY_IDENTIFIER_FILEACCESSMETHOD = 41; - public const UInt32 PROPERTY_IDENTIFIER_FILESIZE = 42; - public const UInt32 PROPERTY_IDENTIFIER_FILETYPE = 43; - public const UInt32 PROPERTY_IDENTIFIER_FIRMWAREREVISION = 44; - public const UInt32 PROPERTY_IDENTIFIER_FLOORTEXT = 464; - public const UInt32 PROPERTY_IDENTIFIER_FULLDUTYBASELINE = 215; - public const UInt32 PROPERTY_IDENTIFIER_GLOBALIDENTIFIER = 323; - public const UInt32 PROPERTY_IDENTIFIER_GROUPID = 465; - public const UInt32 PROPERTY_IDENTIFIER_GROUPMEMBERNAMES = 346; - public const UInt32 PROPERTY_IDENTIFIER_GROUPMEMBERS = 345; - public const UInt32 PROPERTY_IDENTIFIER_GROUPMODE = 467; - public const UInt32 PROPERTY_IDENTIFIER_HIGHLIMIT = 45; - public const UInt32 PROPERTY_IDENTIFIER_HIGHERDECK = 468; - public const UInt32 PROPERTY_IDENTIFIER_INPROCESS = 47; - public const UInt32 PROPERTY_IDENTIFIER_INPROGRESS = 378; - public const UInt32 PROPERTY_IDENTIFIER_INACTIVETEXT = 46; - public const UInt32 PROPERTY_IDENTIFIER_INITIALTIMEOUT = 394; - public const UInt32 PROPERTY_IDENTIFIER_INPUTREFERENCE = 181; - public const UInt32 PROPERTY_IDENTIFIER_INSTALLATIONID = 469; - public const UInt32 PROPERTY_IDENTIFIER_INSTANCEOF = 48; - public const UInt32 PROPERTY_IDENTIFIER_INSTANTANEOUSPOWER = 379; - public const UInt32 PROPERTY_IDENTIFIER_INTEGRALCONSTANT = 49; - public const UInt32 PROPERTY_IDENTIFIER_INTEGRALCONSTANTUNITS = 50; - public const UInt32 PROPERTY_IDENTIFIER_INTERFACEVALUE = 387; - public const UInt32 PROPERTY_IDENTIFIER_INTERVALOFFSET = 195; - public const UInt32 PROPERTY_IDENTIFIER_IPADDRESS = 400; - public const UInt32 PROPERTY_IDENTIFIER_IPDEFAULTGATEWAY = 401; - public const UInt32 PROPERTY_IDENTIFIER_IPDHCPENABLE = 402; - public const UInt32 PROPERTY_IDENTIFIER_IPDHCPLEASETIME = 403; - public const UInt32 PROPERTY_IDENTIFIER_IPDHCPLEASETIMEREMAINING = 404; - public const UInt32 PROPERTY_IDENTIFIER_IPDHCPSERVER = 405; - public const UInt32 PROPERTY_IDENTIFIER_IPDNSSERVER = 406; - public const UInt32 PROPERTY_IDENTIFIER_IPSUBNETMASK = 411; - public const UInt32 PROPERTY_IDENTIFIER_IPV6ADDRESS = 436; - public const UInt32 PROPERTY_IDENTIFIER_IPV6AUTOADDRESSINGENABLE = 442; - public const UInt32 PROPERTY_IDENTIFIER_IPV6DEFAULTGATEWAY = 439; - public const UInt32 PROPERTY_IDENTIFIER_IPV6DHCPLEASETIME = 443; - public const UInt32 PROPERTY_IDENTIFIER_IPV6DHCPLEASETIMEREMAINING = 444; - public const UInt32 PROPERTY_IDENTIFIER_IPV6DHCPSERVER = 445; - public const UInt32 PROPERTY_IDENTIFIER_IPV6DNSSERVER = 441; - public const UInt32 PROPERTY_IDENTIFIER_IPV6PREFIXLENGTH = 437; - public const UInt32 PROPERTY_IDENTIFIER_IPV6ZONEINDEX = 446; - public const UInt32 PROPERTY_IDENTIFIER_ISUTC = 344; - public const UInt32 PROPERTY_IDENTIFIER_KEYSETS = 330; - public const UInt32 PROPERTY_IDENTIFIER_LANDINGCALLCONTROL = 471; - public const UInt32 PROPERTY_IDENTIFIER_LANDINGCALLS = 470; - public const UInt32 PROPERTY_IDENTIFIER_LANDINGDOORSTATUS = 472; - public const UInt32 PROPERTY_IDENTIFIER_LASTACCESSEVENT = 275; - public const UInt32 PROPERTY_IDENTIFIER_LASTACCESSPOINT = 276; - public const UInt32 PROPERTY_IDENTIFIER_LASTCOMMANDTIME = 432; - public const UInt32 PROPERTY_IDENTIFIER_LASTCREDENTIALADDED = 277; - public const UInt32 PROPERTY_IDENTIFIER_LASTCREDENTIALADDEDTIME = 278; - public const UInt32 PROPERTY_IDENTIFIER_LASTCREDENTIALREMOVED = 279; - public const UInt32 PROPERTY_IDENTIFIER_LASTCREDENTIALREMOVEDTIME = 280; - public const UInt32 PROPERTY_IDENTIFIER_LASTKEYSERVER = 331; - public const UInt32 PROPERTY_IDENTIFIER_LASTNOTIFYRECORD = 173; - public const UInt32 PROPERTY_IDENTIFIER_LASTPRIORITY = 369; - public const UInt32 PROPERTY_IDENTIFIER_LASTRESTARTREASON = 196; - public const UInt32 PROPERTY_IDENTIFIER_LASTRESTORETIME = 157; - public const UInt32 PROPERTY_IDENTIFIER_LASTSTATECHANGE = 395; - public const UInt32 PROPERTY_IDENTIFIER_LASTUSETIME = 281; - public const UInt32 PROPERTY_IDENTIFIER_LIFESAFETYALARMVALUES = 166; - public const UInt32 PROPERTY_IDENTIFIER_LIGHTINGCOMMAND = 380; - public const UInt32 PROPERTY_IDENTIFIER_LIGHTINGCOMMANDDEFAULTPRIORITY = 381; - public const UInt32 PROPERTY_IDENTIFIER_LIMITENABLE = 52; - public const UInt32 PROPERTY_IDENTIFIER_LIMITMONITORINGINTERVAL = 182; - public const UInt32 PROPERTY_IDENTIFIER_LINKSPEED = 420; - public const UInt32 PROPERTY_IDENTIFIER_LINKSPEEDAUTONEGOTIATE = 422; - public const UInt32 PROPERTY_IDENTIFIER_LINKSPEEDS = 421; - public const UInt32 PROPERTY_IDENTIFIER_LISTOFGROUPMEMBERS = 53; - public const UInt32 PROPERTY_IDENTIFIER_LISTOFOBJECTPROPERTYREFERENCES = 54; - public const UInt32 PROPERTY_IDENTIFIER_LOCAL_DATE = 56; - public const UInt32 PROPERTY_IDENTIFIER_LOCALFORWARDINGONLY = 360; - public const UInt32 PROPERTY_IDENTIFIER_LOCAL_TIME = 57; - public const UInt32 PROPERTY_IDENTIFIER_LOCATION = 58; - public const UInt32 PROPERTY_IDENTIFIER_LOCKSTATUS = 233; - public const UInt32 PROPERTY_IDENTIFIER_LOCKOUT = 282; - public const UInt32 PROPERTY_IDENTIFIER_LOCKOUTRELINQUISHTIME = 283; - public const UInt32 PROPERTY_IDENTIFIER_LOGBUFFER = 131; - public const UInt32 PROPERTY_IDENTIFIER_LOGDEVICEOBJECTPROPERTY = 132; - public const UInt32 PROPERTY_IDENTIFIER_LOGINTERVAL = 134; - public const UInt32 PROPERTY_IDENTIFIER_LOGGINGOBJECT = 183; - public const UInt32 PROPERTY_IDENTIFIER_LOGGINGRECORD = 184; - public const UInt32 PROPERTY_IDENTIFIER_LOGGINGTYPE = 197; - public const UInt32 PROPERTY_IDENTIFIER_LOWDIFFLIMIT = 390; - public const UInt32 PROPERTY_IDENTIFIER_LOWLIMIT = 59; - public const UInt32 PROPERTY_IDENTIFIER_LOWERDECK = 473; - public const UInt32 PROPERTY_IDENTIFIER_MACADDRESS = 423; - public const UInt32 PROPERTY_IDENTIFIER_MACHINEROOMID = 474; - public const UInt32 PROPERTY_IDENTIFIER_MAINTENANCEREQUIRED = 158; - public const UInt32 PROPERTY_IDENTIFIER_MAKINGCARCALL = 475; - public const UInt32 PROPERTY_IDENTIFIER_MANIPULATEDVARIABLEREFERENCE = 60; - public const UInt32 PROPERTY_IDENTIFIER_MANUALSLAVEADDRESSBINDING = 170; - public const UInt32 PROPERTY_IDENTIFIER_MASKEDALARMVALUES = 234; - public const UInt32 PROPERTY_IDENTIFIER_MAXACTUALVALUE = 382; - public const UInt32 PROPERTY_IDENTIFIER_MAXAPDULENGTHACCEPTED = 62; - public const UInt32 PROPERTY_IDENTIFIER_MAXFAILEDATTEMPTS = 285; - public const UInt32 PROPERTY_IDENTIFIER_MAXINFOFRAMES = 63; - public const UInt32 PROPERTY_IDENTIFIER_MAXMASTER = 64; - public const UInt32 PROPERTY_IDENTIFIER_MAXPRESVALUE = 65; - public const UInt32 PROPERTY_IDENTIFIER_MAXSEGMENTSACCEPTED = 167; - public const UInt32 PROPERTY_IDENTIFIER_MAXIMUMOUTPUT = 61; - public const UInt32 PROPERTY_IDENTIFIER_MAXIMUMVALUE = 135; - public const UInt32 PROPERTY_IDENTIFIER_MAXIMUMVALUETIMESTAMP = 149; - public const UInt32 PROPERTY_IDENTIFIER_MEMBEROF = 159; - public const UInt32 PROPERTY_IDENTIFIER_MEMBERSTATUSFLAGS = 347; - public const UInt32 PROPERTY_IDENTIFIER_MEMBERS = 286; - public const UInt32 PROPERTY_IDENTIFIER_MINACTUALVALUE = 383; - public const UInt32 PROPERTY_IDENTIFIER_MINPRESVALUE = 69; - public const UInt32 PROPERTY_IDENTIFIER_MINIMUMOFFTIME = 66; - public const UInt32 PROPERTY_IDENTIFIER_MINIMUMONTIME = 67; - public const UInt32 PROPERTY_IDENTIFIER_MINIMUMOUTPUT = 68; - public const UInt32 PROPERTY_IDENTIFIER_MINIMUMVALUE = 136; - public const UInt32 PROPERTY_IDENTIFIER_MINIMUMVALUETIMESTAMP = 150; - public const UInt32 PROPERTY_IDENTIFIER_MODE = 160; - public const UInt32 PROPERTY_IDENTIFIER_MODEL_NAME = 70; - public const UInt32 PROPERTY_IDENTIFIER_MODIFICATIONDATE = 71; - public const UInt32 PROPERTY_IDENTIFIER_MUSTERPOINT = 287; - public const UInt32 PROPERTY_IDENTIFIER_NEGATIVEACCESSRULES = 288; - public const UInt32 PROPERTY_IDENTIFIER_NETWORKACCESSSECURITYPOLICIES = 332; - public const UInt32 PROPERTY_IDENTIFIER_NETWORKINTERFACENAME = 424; - public const UInt32 PROPERTY_IDENTIFIER_NETWORKNUMBER = 425; - public const UInt32 PROPERTY_IDENTIFIER_NETWORKNUMBERQUALITY = 426; - public const UInt32 PROPERTY_IDENTIFIER_NETWORKTYPE = 427; - public const UInt32 PROPERTY_IDENTIFIER_NEXTSTOPPINGFLOOR = 476; - public const UInt32 PROPERTY_IDENTIFIER_NODESUBTYPE = 207; - public const UInt32 PROPERTY_IDENTIFIER_NODETYPE = 208; - public const UInt32 PROPERTY_IDENTIFIER_NOTIFICATIONCLASS = 17; - public const UInt32 PROPERTY_IDENTIFIER_NOTIFICATIONTHRESHOLD = 137; - public const UInt32 PROPERTY_IDENTIFIER_NOTIFYTYPE = 72; - public const UInt32 PROPERTY_IDENTIFIER_NUMBEROFAPDURETRIES = 73; - public const UInt32 PROPERTY_IDENTIFIER_NUMBEROFAUTHENTICATIONPOLICIES = 289; - public const UInt32 PROPERTY_IDENTIFIER_NUMBEROFSTATES = 74; - public const UInt32 PROPERTY_IDENTIFIER_OBJECTIDENTIFIER = 75; - public const UInt32 PROPERTY_IDENTIFIER_OBJECTLIST = 76; - public const UInt32 PROPERTY_IDENTIFIER_OBJECT_NAME = 77; - public const UInt32 PROPERTY_IDENTIFIER_OBJECTPROPERTYREFERENCE = 78; - public const UInt32 PROPERTY_IDENTIFIER_OBJECTTYPE = 79; - public const UInt32 PROPERTY_IDENTIFIER_OCCUPANCYCOUNT = 290; - public const UInt32 PROPERTY_IDENTIFIER_OCCUPANCYCOUNTADJUST = 291; - public const UInt32 PROPERTY_IDENTIFIER_OCCUPANCYCOUNTENABLE = 292; - public const UInt32 PROPERTY_IDENTIFIER_OCCUPANCYLOWERLIMIT = 294; - public const UInt32 PROPERTY_IDENTIFIER_OCCUPANCYLOWERLIMITENFORCED = 295; - public const UInt32 PROPERTY_IDENTIFIER_OCCUPANCYSTATE = 296; - public const UInt32 PROPERTY_IDENTIFIER_OCCUPANCYUPPERLIMIT = 297; - public const UInt32 PROPERTY_IDENTIFIER_OCCUPANCYUPPERLIMITENFORCED = 298; - public const UInt32 PROPERTY_IDENTIFIER_OPERATIONDIRECTION = 477; - public const UInt32 PROPERTY_IDENTIFIER_OPERATIONEXPECTED = 161; - public const UInt32 PROPERTY_IDENTIFIER_OPTIONAL = 80; - public const UInt32 PROPERTY_IDENTIFIER_OUT_OF_SERVICE = 81; - public const UInt32 PROPERTY_IDENTIFIER_OUTPUTUNITS = 82; - public const UInt32 PROPERTY_IDENTIFIER_PACKETREORDERTIME = 333; - public const UInt32 PROPERTY_IDENTIFIER_PASSBACKMODE = 300; - public const UInt32 PROPERTY_IDENTIFIER_PASSBACKTIMEOUT = 301; - public const UInt32 PROPERTY_IDENTIFIER_PASSENGERALARM = 478; - public const UInt32 PROPERTY_IDENTIFIER_POLARITY = 84; - public const UInt32 PROPERTY_IDENTIFIER_PORTFILTER = 363; - public const UInt32 PROPERTY_IDENTIFIER_POSITIVEACCESSRULES = 302; - public const UInt32 PROPERTY_IDENTIFIER_POWER = 384; - public const UInt32 PROPERTY_IDENTIFIER_POWERMODE = 479; - public const UInt32 PROPERTY_IDENTIFIER_PRESCALE = 185; - public const UInt32 PROPERTY_IDENTIFIER_PRESENT_VALUE = 85; - public const UInt32 PROPERTY_IDENTIFIER_PRIORITY = 86; - public const UInt32 PROPERTY_IDENTIFIER_PRIORITY_ARRAY = 87; - public const UInt32 PROPERTY_IDENTIFIER_PRIORITYFORWRITING = 88; - public const UInt32 PROPERTY_IDENTIFIER_PROCESSIDENTIFIER = 89; - public const UInt32 PROPERTY_IDENTIFIER_PROCESSIDENTIFIERFILTER = 361; - public const UInt32 PROPERTY_IDENTIFIER_PROFILELOCATION = 485; - public const UInt32 PROPERTY_IDENTIFIER_PROFILENAME = 168; - public const UInt32 PROPERTY_IDENTIFIER_PROGRAMCHANGE = 90; - public const UInt32 PROPERTY_IDENTIFIER_PROGRAMLOCATION = 91; - public const UInt32 PROPERTY_IDENTIFIER_PROGRAMSTATE = 92; - public const UInt32 PROPERTY_IDENTIFIER_PROPERTYLIST = 371; - public const UInt32 PROPERTY_IDENTIFIER_PROPORTIONALCONSTANT = 93; - public const UInt32 PROPERTY_IDENTIFIER_PROPORTIONALCONSTANTUNITS = 94; - public const UInt32 PROPERTY_IDENTIFIER_PROTOCOLLEVEL = 482; - public const UInt32 PROPERTY_IDENTIFIER_PROTOCOLOBJECTTYPESSUPPORTED = 96; - public const UInt32 PROPERTY_IDENTIFIER_PROTOCOLREVISION = 139; - public const UInt32 PROPERTY_IDENTIFIER_PROTOCOLSERVICESSUPPORTED = 97; - public const UInt32 PROPERTY_IDENTIFIER_PROTOCOLVERSION = 98; - public const UInt32 PROPERTY_IDENTIFIER_PULSERATE = 186; - public const UInt32 PROPERTY_IDENTIFIER_READONLY = 99; - public const UInt32 PROPERTY_IDENTIFIER_REASONFORDISABLE = 303; - public const UInt32 PROPERTY_IDENTIFIER_REASONFORHALT = 100; - public const UInt32 PROPERTY_IDENTIFIER_RECIPIENTLIST = 102; - public const UInt32 PROPERTY_IDENTIFIER_RECORDCOUNT = 141; - public const UInt32 PROPERTY_IDENTIFIER_RECORDSSINCENOTIFICATION = 140; - public const UInt32 PROPERTY_IDENTIFIER_REFERENCEPORT = 483; - public const UInt32 PROPERTY_IDENTIFIER_REGISTEREDCARCALL = 480; - public const UInt32 PROPERTY_IDENTIFIER_RELIABILITY = 103; - public const UInt32 PROPERTY_IDENTIFIER_RELIABILITYEVALUATIONINHIBIT = 357; - public const UInt32 PROPERTY_IDENTIFIER_RELINQUISHDEFAULT = 104; - public const UInt32 PROPERTY_IDENTIFIER_REPRESENTS = 491; - public const UInt32 PROPERTY_IDENTIFIER_REQUESTEDSHEDLEVEL = 218; - public const UInt32 PROPERTY_IDENTIFIER_REQUESTEDUPDATEINTERVAL = 348; - public const UInt32 PROPERTY_IDENTIFIER_REQUIRED = 105; - public const UInt32 PROPERTY_IDENTIFIER_RESOLUTION = 106; - public const UInt32 PROPERTY_IDENTIFIER_RESTARTNOTIFICATIONRECIPIENTS = 202; - public const UInt32 PROPERTY_IDENTIFIER_RESTORECOMPLETIONTIME = 340; - public const UInt32 PROPERTY_IDENTIFIER_RESTOREPREPARATIONTIME = 341; - public const UInt32 PROPERTY_IDENTIFIER_ROUTINGTABLE = 428; - public const UInt32 PROPERTY_IDENTIFIER_SCALE = 187; - public const UInt32 PROPERTY_IDENTIFIER_SCALEFACTOR = 188; - public const UInt32 PROPERTY_IDENTIFIER_SCHEDULEDEFAULT = 174; - public const UInt32 PROPERTY_IDENTIFIER_SECUREDSTATUS = 235; - public const UInt32 PROPERTY_IDENTIFIER_SECURITYPDUTIMEOUT = 334; - public const UInt32 PROPERTY_IDENTIFIER_SECURITYTIMEWINDOW = 335; - public const UInt32 PROPERTY_IDENTIFIER_SEGMENTATIONSUPPORTED = 107; - public const UInt32 PROPERTY_IDENTIFIER_SERIALNUMBER = 372; - public const UInt32 PROPERTY_IDENTIFIER_SETPOINT = 108; - public const UInt32 PROPERTY_IDENTIFIER_SETPOINTREFERENCE = 109; - public const UInt32 PROPERTY_IDENTIFIER_SETTING = 162; - public const UInt32 PROPERTY_IDENTIFIER_SHEDDURATION = 219; - public const UInt32 PROPERTY_IDENTIFIER_SHEDLEVELDESCRIPTIONS = 220; - public const UInt32 PROPERTY_IDENTIFIER_SHEDLEVELS = 221; - public const UInt32 PROPERTY_IDENTIFIER_SILENCED = 163; - public const UInt32 PROPERTY_IDENTIFIER_SLAVEADDRESSBINDING = 171; - public const UInt32 PROPERTY_IDENTIFIER_SLAVEPROXYENABLE = 172; - public const UInt32 PROPERTY_IDENTIFIER_STARTTIME = 142; - public const UInt32 PROPERTY_IDENTIFIER_STATECHANGEVALUES = 396; - public const UInt32 PROPERTY_IDENTIFIER_STATEDESCRIPTION = 222; - public const UInt32 PROPERTY_IDENTIFIER_STATETEXT = 110; - public const UInt32 PROPERTY_IDENTIFIER_STATUSFLAGS = 111; - public const UInt32 PROPERTY_IDENTIFIER_STOPTIME = 143; - public const UInt32 PROPERTY_IDENTIFIER_STOPWHENFULL = 144; - public const UInt32 PROPERTY_IDENTIFIER_STRIKECOUNT = 391; - public const UInt32 PROPERTY_IDENTIFIER_STRUCTUREDOBJECTLIST = 209; - public const UInt32 PROPERTY_IDENTIFIER_SUBORDINATEANNOTATIONS = 210; - public const UInt32 PROPERTY_IDENTIFIER_SUBORDINATELIST = 211; - public const UInt32 PROPERTY_IDENTIFIER_SUBORDINATENODETYPES = 487; - public const UInt32 PROPERTY_IDENTIFIER_SUBORDINATERELATIONSHIPS = 489; - public const UInt32 PROPERTY_IDENTIFIER_SUBORDINATETAGS = 488; - public const UInt32 PROPERTY_IDENTIFIER_SUBSCRIBEDRECIPIENTS = 362; - public const UInt32 PROPERTY_IDENTIFIER_SUPPORTEDFORMATCLASSES = 305; - public const UInt32 PROPERTY_IDENTIFIER_SUPPORTEDFORMATS = 304; - public const UInt32 PROPERTY_IDENTIFIER_SUPPORTEDSECURITYALGORITHMS = 336; - public const UInt32 PROPERTY_IDENTIFIER_SYSTEMSTATUS = 112; - public const UInt32 PROPERTY_IDENTIFIER_TAGS = 486; - public const UInt32 PROPERTY_IDENTIFIER_THREATAUTHORITY = 306; - public const UInt32 PROPERTY_IDENTIFIER_THREATLEVEL = 307; - public const UInt32 PROPERTY_IDENTIFIER_TIMEDELAY = 113; - public const UInt32 PROPERTY_IDENTIFIER_TIMEDELAYNORMAL = 356; - public const UInt32 PROPERTY_IDENTIFIER_TIMEOFACTIVETIMERESET = 114; - public const UInt32 PROPERTY_IDENTIFIER_TIMEOFDEVICERESTART = 203; - public const UInt32 PROPERTY_IDENTIFIER_TIMEOFSTATECOUNTRESET = 115; - public const UInt32 PROPERTY_IDENTIFIER_TIMEOFSTRIKECOUNTRESET = 392; - public const UInt32 PROPERTY_IDENTIFIER_TIMESYNCHRONIZATIONINTERVAL = 204; - public const UInt32 PROPERTY_IDENTIFIER_TIMESYNCHRONIZATIONRECIPIENTS = 116; - public const UInt32 PROPERTY_IDENTIFIER_TIMERRUNNING = 397; - public const UInt32 PROPERTY_IDENTIFIER_TIMERSTATE = 398; - public const UInt32 PROPERTY_IDENTIFIER_TOTALRECORDCOUNT = 145; - public const UInt32 PROPERTY_IDENTIFIER_TRACEFLAG = 308; - public const UInt32 PROPERTY_IDENTIFIER_TRACKINGVALUE = 164; - public const UInt32 PROPERTY_IDENTIFIER_TRANSACTIONNOTIFICATIONCLASS = 309; - public const UInt32 PROPERTY_IDENTIFIER_TRANSITION = 385; - public const UInt32 PROPERTY_IDENTIFIER_TRIGGER = 205; - public const UInt32 PROPERTY_IDENTIFIER_UNITS = 117; - public const UInt32 PROPERTY_IDENTIFIER_UPDATEINTERVAL = 118; - public const UInt32 PROPERTY_IDENTIFIER_UPDATEKEYSETTIMEOUT = 337; - public const UInt32 PROPERTY_IDENTIFIER_UPDATETIME = 189; - public const UInt32 PROPERTY_IDENTIFIER_USEREXTERNALIDENTIFIER = 310; - public const UInt32 PROPERTY_IDENTIFIER_USERINFORMATIONREFERENCE = 311; - public const UInt32 PROPERTY_IDENTIFIER_USERNAME = 317; - public const UInt32 PROPERTY_IDENTIFIER_USERTYPE = 318; - public const UInt32 PROPERTY_IDENTIFIER_USESREMAINING = 319; - public const UInt32 PROPERTY_IDENTIFIER_UTC_OFFSET = 119; - public const UInt32 PROPERTY_IDENTIFIER_UTCTIMESYNCHRONIZATIONRECIPIENTS = 206; - public const UInt32 PROPERTY_IDENTIFIER_VALIDSAMPLES = 146; - public const UInt32 PROPERTY_IDENTIFIER_VALUEBEFORECHANGE = 190; - public const UInt32 PROPERTY_IDENTIFIER_VALUECHANGETIME = 192; - public const UInt32 PROPERTY_IDENTIFIER_VALUESET = 191; - public const UInt32 PROPERTY_IDENTIFIER_VALUESOURCE = 433; - public const UInt32 PROPERTY_IDENTIFIER_VALUESOURCEARRAY = 434; - public const UInt32 PROPERTY_IDENTIFIER_VARIANCEVALUE = 151; - public const UInt32 PROPERTY_IDENTIFIER_VENDOR_IDENTIFIER = 120; - public const UInt32 PROPERTY_IDENTIFIER_VENDOR_NAME = 121; - public const UInt32 PROPERTY_IDENTIFIER_VERIFICATIONTIME = 326; - public const UInt32 PROPERTY_IDENTIFIER_VIRTUALMACADDRESSTABLE = 429; - public const UInt32 PROPERTY_IDENTIFIER_VTCLASSESSUPPORTED = 122; - public const UInt32 PROPERTY_IDENTIFIER_WEEKLYSCHEDULE = 123; - public const UInt32 PROPERTY_IDENTIFIER_WINDOWINTERVAL = 147; - public const UInt32 PROPERTY_IDENTIFIER_WINDOWSAMPLES = 148; - public const UInt32 PROPERTY_IDENTIFIER_WRITESTATUS = 370; - public const UInt32 PROPERTY_IDENTIFIER_ZONEFROM = 320; - public const UInt32 PROPERTY_IDENTIFIER_ZONEMEMBERS = 165; - public const UInt32 PROPERTY_IDENTIFIER_ZONETO = 32; - #endregion - - #region Data Types - // BACnetPrimitiveBase.h - public const Byte DATA_TYPE_NULL = 0; - public const Byte DATA_TYPE_BOOLEAN = 1; - public const Byte DATA_TYPE_UNSIGNED_INTEGER = 2; - public const Byte DATA_TYPE_SIGNED_INTEGER = 3; // 2's complement notation - public const Byte DATA_TYPE_REAL = 4; // ANSI/IEEE-754 floating point - public const Byte DATA_TYPE_DOUBLE = 5; // ANSI/IEEE-754 double precision floating point - public const Byte DATA_TYPE_OCTET_STRING = 6; - public const Byte DATA_TYPE_CHARACTER_STRING = 7; - public const Byte DATA_TYPE_BITSTRING = 8; - public const Byte DATA_TYPE_ENUMERATED = 9; - public const Byte DATA_TYPE_DATE = 10; - public const Byte DATA_TYPE_TIME = 11; - public const Byte DATA_TYPE_OBJECT_IDENTIFIER = 12; - #endregion - - #region BACnetEngineeringUnits - // Full list in BACnetEngineeringUnits.h - public const UInt32 ENGINEERING_UNITS_METERSPERSECONDPERSECOND = 166; - public const UInt32 ENGINEERING_UNITS_SQUAREMETERS = 0; - public const UInt32 ENGINEERING_UNITS_SQUARECENTIMETERS = 116; - public const UInt32 ENGINEERING_UNITS_SQUAREFEET = 1; - public const UInt32 ENGINEERING_UNITS_SQUAREINCHES = 115; - public const UInt32 ENGINEERING_UNITS_CURRENCY1 = 105; - public const UInt32 ENGINEERING_UNITS_CURRENCY2 = 106; - public const UInt32 ENGINEERING_UNITS_CURRENCY3 = 107; - public const UInt32 ENGINEERING_UNITS_CURRENCY4 = 108; - public const UInt32 ENGINEERING_UNITS_CURRENCY5 = 109; - public const UInt32 ENGINEERING_UNITS_CURRENCY6 = 110; - public const UInt32 ENGINEERING_UNITS_CURRENCY7 = 111; - public const UInt32 ENGINEERING_UNITS_CURRENCY8 = 112; - public const UInt32 ENGINEERING_UNITS_CURRENCY9 = 113; - public const UInt32 ENGINEERING_UNITS_CURRENCY10 = 114; - public const UInt32 ENGINEERING_UNITS_MILLIAMPERES = 2; - public const UInt32 ENGINEERING_UNITS_AMPERES = 3; - public const UInt32 ENGINEERING_UNITS_AMPERESPERMETER = 167; - public const UInt32 ENGINEERING_UNITS_AMPERESPERSQUAREMETER = 168; - public const UInt32 ENGINEERING_UNITS_AMPERESQUAREMETERS = 169; - public const UInt32 ENGINEERING_UNITS_DECIBELS = 199; - public const UInt32 ENGINEERING_UNITS_DECIBELSMILLIVOLT = 200; - public const UInt32 ENGINEERING_UNITS_DECIBELSVOLT = 201; - public const UInt32 ENGINEERING_UNITS_FARADS = 170; - public const UInt32 ENGINEERING_UNITS_HENRYS = 171; - public const UInt32 ENGINEERING_UNITS_OHMS = 4; - public const UInt32 ENGINEERING_UNITS_OHMMETERSQUAREDPERMETER = 237; - public const UInt32 ENGINEERING_UNITS_OHMMETERS = 172; - public const UInt32 ENGINEERING_UNITS_MILLIOHMS = 145; - public const UInt32 ENGINEERING_UNITS_KILOHMS = 122; - public const UInt32 ENGINEERING_UNITS_MEGOHMS = 123; - public const UInt32 ENGINEERING_UNITS_MICROSIEMENS = 190; - public const UInt32 ENGINEERING_UNITS_MILLISIEMENS = 202; - public const UInt32 ENGINEERING_UNITS_SIEMENS = 173; - public const UInt32 ENGINEERING_UNITS_SIEMENSPERMETER = 174; - public const UInt32 ENGINEERING_UNITS_TESLAS = 175; - public const UInt32 ENGINEERING_UNITS_VOLTS = 5; - public const UInt32 ENGINEERING_UNITS_MILLIVOLTS = 124; - public const UInt32 ENGINEERING_UNITS_KILOVOLTS = 6; - public const UInt32 ENGINEERING_UNITS_MEGAVOLTS = 7; - public const UInt32 ENGINEERING_UNITS_VOLTAMPERES = 8; - public const UInt32 ENGINEERING_UNITS_KILOVOLTAMPERES = 9; - public const UInt32 ENGINEERING_UNITS_MEGAVOLTAMPERES = 10; - public const UInt32 ENGINEERING_UNITS_VOLT_AMPERES_REACTIVE = 11; - public const UInt32 ENGINEERING_UNITS_KILOVOLTAMPERESREACTIVE = 12; - public const UInt32 ENGINEERING_UNITS_MEGAVOLTAMPERESREACTIVE = 13; - public const UInt32 ENGINEERING_UNITS_VOLTSPERDEGREEKELVIN = 176; - public const UInt32 ENGINEERING_UNITS_VOLTSPERMETER = 177; - public const UInt32 ENGINEERING_UNITS_DEGREESPHASE = 14; - public const UInt32 ENGINEERING_UNITS_POWERFACTOR = 15; - public const UInt32 ENGINEERING_UNITS_WEBERS = 178; - public const UInt32 ENGINEERING_UNITS_AMPERESECONDS = 238; - public const UInt32 ENGINEERING_UNITS_VOLTAMPEREHOURS = 239; - public const UInt32 ENGINEERING_UNITS_KILOVOLTAMPEREHOURS = 240; - public const UInt32 ENGINEERING_UNITS_MEGAVOLTAMPEREHOURS = 241; - public const UInt32 ENGINEERING_UNITS_VOLTAMPEREHOURSREACTIVE = 242; - public const UInt32 ENGINEERING_UNITS_KILOVOLTAMPEREHOURSREACTIVE = 243; - public const UInt32 ENGINEERING_UNITS_MEGAVOLTAMPEREHOURSREACTIVE = 244; - public const UInt32 ENGINEERING_UNITS_VOLTSQUAREHOURS = 245; - public const UInt32 ENGINEERING_UNITS_AMPERESQUAREHOURS = 246; - public const UInt32 ENGINEERING_UNITS_JOULES = 16; - public const UInt32 ENGINEERING_UNITS_KILOJOULES = 17; - public const UInt32 ENGINEERING_UNITS_KILOJOULESPERKILOGRAM = 125; - public const UInt32 ENGINEERING_UNITS_MEGAJOULES = 126; - public const UInt32 ENGINEERING_UNITS_WATT_HOURS = 18; - public const UInt32 ENGINEERING_UNITS_KILOWATT_HOURS = 19; - public const UInt32 ENGINEERING_UNITS_MEGAWATT_HOURS = 146; - public const UInt32 ENGINEERING_UNITS_WATTHOURSREACTIVE = 203; - public const UInt32 ENGINEERING_UNITS_KILOWATTHOURSREACTIVE = 204; - public const UInt32 ENGINEERING_UNITS_MEGAWATTHOURSREACTIVE = 205; - public const UInt32 ENGINEERING_UNITS_BTUS = 20; - public const UInt32 ENGINEERING_UNITS_KILOBTUS = 147; - public const UInt32 ENGINEERING_UNITS_MEGABTUS = 148; - public const UInt32 ENGINEERING_UNITS_THERMS = 21; - public const UInt32 ENGINEERING_UNITS_TONHOURS = 22; - public const UInt32 ENGINEERING_UNITS_JOULESPERKILOGRAMDRYAIR = 23; - public const UInt32 ENGINEERING_UNITS_KILOJOULESPERKILOGRAMDRYAIR = 149; - public const UInt32 ENGINEERING_UNITS_MEGAJOULESPERKILOGRAMDRYAIR = 150; - public const UInt32 ENGINEERING_UNITS_BTUSPERPOUNDDRYAIR = 24; - public const UInt32 ENGINEERING_UNITS_BTUSPERPOUND = 117; - public const UInt32 ENGINEERING_UNITS_JOULESPERDEGREEKELVIN = 127; - public const UInt32 ENGINEERING_UNITS_KILOJOULESPERDEGREEKELVIN = 151; - public const UInt32 ENGINEERING_UNITS_MEGAJOULESPERDEGREEKELVIN = 152; - public const UInt32 ENGINEERING_UNITS_JOULESPERKILOGRAMDEGREEKELVIN = 128; - public const UInt32 ENGINEERING_UNITS_NEWTON = 153; - public const UInt32 ENGINEERING_UNITS_CYCLESPERHOUR = 25; - public const UInt32 ENGINEERING_UNITS_CYCLESPERMINUTE = 26; - public const UInt32 ENGINEERING_UNITS_HERTZ = 27; - public const UInt32 ENGINEERING_UNITS_KILOHERTZ = 129; - public const UInt32 ENGINEERING_UNITS_MEGAHERTZ = 130; - public const UInt32 ENGINEERING_UNITS_PERHOUR = 131; - public const UInt32 ENGINEERING_UNITS_GRAMSOFWATERPERKILOGRAMDRYAIR = 28; - public const UInt32 ENGINEERING_UNITS_PERCENTRELATIVEHUMIDITY = 29; - public const UInt32 ENGINEERING_UNITS_MICROMETERS = 194; - public const UInt32 ENGINEERING_UNITS_MILLIMETERS = 30; - public const UInt32 ENGINEERING_UNITS_CENTIMETERS = 118; - public const UInt32 ENGINEERING_UNITS_KILOMETERS = 193; - public const UInt32 ENGINEERING_UNITS_METERS = 31; - public const UInt32 ENGINEERING_UNITS_INCHES = 32; - public const UInt32 ENGINEERING_UNITS_FEET = 33; - public const UInt32 ENGINEERING_UNITS_CANDELAS = 179; - public const UInt32 ENGINEERING_UNITS_CANDELASPERSQUAREMETER = 180; - public const UInt32 ENGINEERING_UNITS_WATTSPERSQUAREFOOT = 34; - public const UInt32 ENGINEERING_UNITS_WATTSPERSQUAREMETER = 35; - public const UInt32 ENGINEERING_UNITS_LUMENS = 36; - public const UInt32 ENGINEERING_UNITS_LUXES = 37; - public const UInt32 ENGINEERING_UNITS_FOOTCANDLES = 38; - public const UInt32 ENGINEERING_UNITS_MILLIGRAMS = 196; - public const UInt32 ENGINEERING_UNITS_GRAMS = 195; - public const UInt32 ENGINEERING_UNITS_KILOGRAMS = 39; - public const UInt32 ENGINEERING_UNITS_POUNDSMASS = 40; - public const UInt32 ENGINEERING_UNITS_TONS = 41; - public const UInt32 ENGINEERING_UNITS_GRAMSPERSECOND = 154; - public const UInt32 ENGINEERING_UNITS_GRAMSPERMINUTE = 155; - public const UInt32 ENGINEERING_UNITS_KILOGRAMSPERSECOND = 42; - public const UInt32 ENGINEERING_UNITS_KILOGRAMSPERMINUTE = 43; - public const UInt32 ENGINEERING_UNITS_KILOGRAMSPERHOUR = 44; - public const UInt32 ENGINEERING_UNITS_POUNDSMASSPERSECOND = 119; - public const UInt32 ENGINEERING_UNITS_POUNDSMASSPERMINUTE = 45; - public const UInt32 ENGINEERING_UNITS_POUNDSMASSPERHOUR = 46; - public const UInt32 ENGINEERING_UNITS_TONSPERHOUR = 156; - public const UInt32 ENGINEERING_UNITS_MILLIWATTS = 132; - public const UInt32 ENGINEERING_UNITS_WATTS = 47; - public const UInt32 ENGINEERING_UNITS_KILOWATTS = 48; - public const UInt32 ENGINEERING_UNITS_MEGAWATTS = 49; - public const UInt32 ENGINEERING_UNITS_BTUSPERHOUR = 50; - public const UInt32 ENGINEERING_UNITS_KILOBTUSPERHOUR = 157; - public const UInt32 ENGINEERING_UNITS_JOULEPERHOURS = 247; - public const UInt32 ENGINEERING_UNITS_HORSEPOWER = 51; - public const UInt32 ENGINEERING_UNITS_TONSREFRIGERATION = 52; - public const UInt32 ENGINEERING_UNITS_PASCALS = 53; - public const UInt32 ENGINEERING_UNITS_HECTOPASCALS = 133; - public const UInt32 ENGINEERING_UNITS_KILOPASCALS = 54; - public const UInt32 ENGINEERING_UNITS_MILLIBARS = 134; - public const UInt32 ENGINEERING_UNITS_BARS = 55; - public const UInt32 ENGINEERING_UNITS_POUNDSFORCEPERSQUAREINCH = 56; - public const UInt32 ENGINEERING_UNITS_MILLIMETERSOFWATER = 206; - public const UInt32 ENGINEERING_UNITS_CENTIMETERSOFWATER = 57; - public const UInt32 ENGINEERING_UNITS_INCHESOFWATER = 58; - public const UInt32 ENGINEERING_UNITS_MILLIMETERSOFMERCURY = 59; - public const UInt32 ENGINEERING_UNITS_CENTIMETERSOFMERCURY = 60; - public const UInt32 ENGINEERING_UNITS_INCHESOFMERCURY = 61; - public const UInt32 ENGINEERING_UNITS_DEGREESCELSIUS = 62; - public const UInt32 ENGINEERING_UNITS_DEGREESKELVIN = 63; - public const UInt32 ENGINEERING_UNITS_DEGREESKELVINPERHOUR = 181; - public const UInt32 ENGINEERING_UNITS_DEGREESKELVINPERMINUTE = 182; - public const UInt32 ENGINEERING_UNITS_DEGREESFAHRENHEIT = 64; - public const UInt32 ENGINEERING_UNITS_DEGREEDAYSCELSIUS = 65; - public const UInt32 ENGINEERING_UNITS_DEGREEDAYSFAHRENHEIT = 66; - public const UInt32 ENGINEERING_UNITS_DELTADEGREESFAHRENHEIT = 120; - public const UInt32 ENGINEERING_UNITS_DELTADEGREESKELVIN = 121; - public const UInt32 ENGINEERING_UNITS_YEARS = 67; - public const UInt32 ENGINEERING_UNITS_MONTHS = 68; - public const UInt32 ENGINEERING_UNITS_WEEKS = 69; - public const UInt32 ENGINEERING_UNITS_DAYS = 70; - public const UInt32 ENGINEERING_UNITS_HOURS = 71; - public const UInt32 ENGINEERING_UNITS_MINUTES = 72; - public const UInt32 ENGINEERING_UNITS_SECONDS = 73; - public const UInt32 ENGINEERING_UNITS_HUNDREDTHSSECONDS = 158; - public const UInt32 ENGINEERING_UNITS_MILLISECONDS = 159; - public const UInt32 ENGINEERING_UNITS_NEWTONMETERS = 160; - public const UInt32 ENGINEERING_UNITS_MILLIMETERSPERSECOND = 161; - public const UInt32 ENGINEERING_UNITS_MILLIMETERSPERMINUTE = 162; - public const UInt32 ENGINEERING_UNITS_METERSPERSECOND = 74; - public const UInt32 ENGINEERING_UNITS_METERSPERMINUTE = 163; - public const UInt32 ENGINEERING_UNITS_METERSPERHOUR = 164; - public const UInt32 ENGINEERING_UNITS_KILOMETERSPERHOUR = 75; - public const UInt32 ENGINEERING_UNITS_FEETPERSECOND = 76; - public const UInt32 ENGINEERING_UNITS_FEETPERMINUTE = 77; - public const UInt32 ENGINEERING_UNITS_MILESPERHOUR = 78; - public const UInt32 ENGINEERING_UNITS_CUBICFEET = 79; - public const UInt32 ENGINEERING_UNITS_CUBICMETERS = 80; - public const UInt32 ENGINEERING_UNITS_IMPERIALGALLONS = 81; - public const UInt32 ENGINEERING_UNITS_MILLILITERS = 197; - public const UInt32 ENGINEERING_UNITS_LITERS = 82; - public const UInt32 ENGINEERING_UNITS_USGALLONS = 83; - public const UInt32 ENGINEERING_UNITS_CUBICFEETPERSECOND = 142; - public const UInt32 ENGINEERING_UNITS_CUBICFEETPERMINUTE = 84; - public const UInt32 ENGINEERING_UNITS_MILLIONSTANDARDCUBICFEETPERMINUTE = 254; - public const UInt32 ENGINEERING_UNITS_CUBICFEETPERHOUR = 191; - public const UInt32 ENGINEERING_UNITS_CUBICFEETPERDAY = 248; - public const UInt32 ENGINEERING_UNITS_STANDARDCUBICFEETPERDAY = 47808; - public const UInt32 ENGINEERING_UNITS_MILLIONSTANDARDCUBICFEETPERDAY = 47809; - public const UInt32 ENGINEERING_UNITS_THOUSANDCUBICFEETPERDAY = 47810; - public const UInt32 ENGINEERING_UNITS_THOUSANDSTANDARDCUBICFEETPERDAY = 47811; - public const UInt32 ENGINEERING_UNITS_POUNDSMASSPERDAY = 47812; - public const UInt32 ENGINEERING_UNITS_CUBICMETERSPERSECOND = 85; - public const UInt32 ENGINEERING_UNITS_CUBICMETERSPERMINUTE = 165; - public const UInt32 ENGINEERING_UNITS_CUBICMETERSPERHOUR = 135; - public const UInt32 ENGINEERING_UNITS_CUBICMETERSPERDAY = 249; - public const UInt32 ENGINEERING_UNITS_IMPERIALGALLONSPERMINUTE = 86; - public const UInt32 ENGINEERING_UNITS_MILLILITERSPERSECOND = 198; - public const UInt32 ENGINEERING_UNITS_LITERSPERSECOND = 87; - public const UInt32 ENGINEERING_UNITS_LITERSPERMINUTE = 88; - public const UInt32 ENGINEERING_UNITS_LITERSPERHOUR = 136; - public const UInt32 ENGINEERING_UNITS_USGALLONSPERMINUTE = 89; - public const UInt32 ENGINEERING_UNITS_USGALLONSPERHOUR = 192; - public const UInt32 ENGINEERING_UNITS_DEGREESANGULAR = 90; - public const UInt32 ENGINEERING_UNITS_DEGREESCELSIUSPERHOUR = 91; - public const UInt32 ENGINEERING_UNITS_DEGREESCELSIUSPERMINUTE = 92; - public const UInt32 ENGINEERING_UNITS_DEGREESFAHRENHEITPERHOUR = 93; - public const UInt32 ENGINEERING_UNITS_DEGREESFAHRENHEITPERMINUTE = 94; - public const UInt32 ENGINEERING_UNITS_JOULESECONDS = 183; - public const UInt32 ENGINEERING_UNITS_KILOGRAMSPERCUBICMETER = 186; - public const UInt32 ENGINEERING_UNITS_KILOWATTHOURSPERSQUAREMETER = 137; - public const UInt32 ENGINEERING_UNITS_KILOWATTHOURSPERSQUAREFOOT = 138; - public const UInt32 ENGINEERING_UNITS_WATTHOURSPERCUBICMETER = 250; - public const UInt32 ENGINEERING_UNITS_JOULESPERCUBICMETER = 251; - public const UInt32 ENGINEERING_UNITS_MEGAJOULESPERSQUAREMETER = 139; - public const UInt32 ENGINEERING_UNITS_MEGAJOULESPERSQUAREFOOT = 140; - public const UInt32 ENGINEERING_UNITS_MOLEPERCENT = 252; - public const UInt32 ENGINEERING_UNITS_NO_UNITS = 95; - public const UInt32 ENGINEERING_UNITS_NEWTONSECONDS = 187; - public const UInt32 ENGINEERING_UNITS_NEWTONSPERMETER = 188; - public const UInt32 ENGINEERING_UNITS_PARTSPERMILLION = 96; - public const UInt32 ENGINEERING_UNITS_PARTSPERBILLION = 97; - public const UInt32 ENGINEERING_UNITS_PASCALSECONDS = 253; - public const UInt32 ENGINEERING_UNITS_PERCENT = 98; - public const UInt32 ENGINEERING_UNITS_PERCENTOBSCURATIONPERFOOT = 143; - public const UInt32 ENGINEERING_UNITS_PERCENTOBSCURATIONPERMETER = 144; - public const UInt32 ENGINEERING_UNITS_PERCENTPERSECOND = 99; - public const UInt32 ENGINEERING_UNITS_PERMINUTE = 100; - public const UInt32 ENGINEERING_UNITS_PERSECOND = 101; - public const UInt32 ENGINEERING_UNITS_PSIPERDEGREEFAHRENHEIT = 102; - public const UInt32 ENGINEERING_UNITS_RADIANS = 103; - public const UInt32 ENGINEERING_UNITS_RADIANSPERSECOND = 184; - public const UInt32 ENGINEERING_UNITS_REVOLUTIONSPERMINUTE = 104; - public const UInt32 ENGINEERING_UNITS_SQUAREMETERSPERNEWTON = 185; - public const UInt32 ENGINEERING_UNITS_WATTSPERMETERPERDEGREEKELVIN = 189; - public const UInt32 ENGINEERING_UNITS_WATTSPERSQUAREMETERDEGREEKELVIN = 141; - public const UInt32 ENGINEERING_UNITS_PERMILLE = 207; - public const UInt32 ENGINEERING_UNITS_GRAMSPERGRAM = 208; - public const UInt32 ENGINEERING_UNITS_KILOGRAMSPERKILOGRAM = 209; - public const UInt32 ENGINEERING_UNITS_GRAMSPERKILOGRAM = 210; - public const UInt32 ENGINEERING_UNITS_MILLIGRAMSPERGRAM = 211; - public const UInt32 ENGINEERING_UNITS_MILLIGRAMSPERKILOGRAM = 212; - public const UInt32 ENGINEERING_UNITS_GRAMSPERMILLILITER = 213; - public const UInt32 ENGINEERING_UNITS_GRAMSPERLITER = 214; - public const UInt32 ENGINEERING_UNITS_MILLIGRAMSPERLITER = 215; - public const UInt32 ENGINEERING_UNITS_MICROGRAMSPERLITER = 216; - public const UInt32 ENGINEERING_UNITS_GRAMSPERCUBICMETER = 217; - public const UInt32 ENGINEERING_UNITS_MILLIGRAMSPERCUBICMETER = 218; - public const UInt32 ENGINEERING_UNITS_MICROGRAMSPERCUBICMETER = 219; - public const UInt32 ENGINEERING_UNITS_NANOGRAMSPERCUBICMETER = 220; - public const UInt32 ENGINEERING_UNITS_GRAMSPERCUBICCENTIMETER = 221; - public const UInt32 ENGINEERING_UNITS_BECQUERELS = 222; - public const UInt32 ENGINEERING_UNITS_KILOBECQUERELS = 223; - public const UInt32 ENGINEERING_UNITS_MEGABECQUERELS = 224; - public const UInt32 ENGINEERING_UNITS_GRAY = 225; - public const UInt32 ENGINEERING_UNITS_MILLIGRAY = 226; - public const UInt32 ENGINEERING_UNITS_MICROGRAY = 227; - public const UInt32 ENGINEERING_UNITS_SIEVERTS = 228; - public const UInt32 ENGINEERING_UNITS_MILLISIEVERTS = 229; - public const UInt32 ENGINEERING_UNITS_MICROSIEVERTS = 230; - public const UInt32 ENGINEERING_UNITS_MICROSIEVERTSPERHOUR = 231; - public const UInt32 ENGINEERING_UNITS_MILLIREMS = 47814; - public const UInt32 ENGINEERING_UNITS_MILLIREMSPERHOUR = 47815; - public const UInt32 ENGINEERING_UNITS_DECIBELSA = 232; - public const UInt32 ENGINEERING_UNITS_NEPHELOMETRICTURBIDITYUNIT = 233; - public const UInt32 ENGINEERING_UNITS_PH = 234; - public const UInt32 ENGINEERING_UNITS_GRAMSPERSQUAREMETER = 235; - public const UInt32 ENGINEERING_UNITS_MINUTESPERDEGREEKELVIN = 236; - #endregion - - #region Get Callback functions delegate - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate UInt16 delegateSendMessage(System.Byte* message, UInt16 messageLength, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, [In, MarshalAs(UnmanagedType.I1)] bool broadcast); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate UInt16 delegateRecvMessage(System.Byte* message, UInt16 maxMessageLength, System.Byte* receivedConnectionString, System.Byte maxConnectionStringLength, System.Byte* receivedConnectionStringLength, System.Byte* networkType); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetPropertyCharString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, System.Char* value, UInt32* valueElementCount, UInt32 maxElementCount, System.Byte encodingType, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetPropertyReal(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, float* value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyReal(bool deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, float value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate ulong delegateCallbackGetSystemTime(); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetPropertyBool(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool* value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetEnumerated(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, UInt32* value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetPropertyDate(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte* year, Byte* month, Byte* day, Byte* weekday, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetPropertyDouble(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Double* value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetPropertySignedInteger(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Int32* value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetPropertyUnsignedInteger(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, UInt32* value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetPropertyTime(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte* hour, Byte* minute, Byte* second, Byte* hundrethSeconds, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetPropertyOctetString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte* value, UInt32* valueElementCount, UInt32 maxElementCount, System.Byte encodingType, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetListOfEnumerations(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte rangeOption, UInt32 rangeIndexOrSequenceNumber, [In, MarshalAs(UnmanagedType.I1)] bool rangeInPositiveDirection, UInt32* enumeration, bool *more); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackGetListElevatorGroupLandingCall(UInt32 deviceInstance, UInt32 elevatorGroupInstance, Byte rangeOption, UInt32 rangeIndexOrSequence, Byte* floorNumber, Byte* commandChoice, UInt32* bacnetLiftCarDirection, Byte* destination, bool* useFloorText, System.Char* floorText, UInt16 floorTextMaxLength, UInt16* floorTextLength, bool* more); - #endregion - - #region Set Callback functions delegate - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyEnumerated(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, UInt32 value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyUnsignedInteger(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, UInt32 value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertySignedInteger(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Int32 value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyNull(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyDouble(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Double value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyBool(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyTime(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte hour, Byte minute, Byte second, Byte hundrethSeconds, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyDate(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte year, Byte month, Byte day, Byte weekday, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyCharacterString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, char* value, UInt32 length, Byte encodingType, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyOctetString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte* value, UInt32 length, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool delegateCallbackSetPropertyBitString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool* value, UInt32 length, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode); - #endregion - - #region General BACnet functions. - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_GetAPIMajorVersion", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int GetAPIMajorVersion(); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_GetAPIMinorVersion", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int GetAPIMinorVersion(); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_GetAPIPatchVersion", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int GetAPIPatchVersion(); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_GetAPIBuildVersion", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int GetAPIBuildVersion(); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackReceiveMessage", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackReceiveMessage(delegateRecvMessage recvMessage); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSendMessage", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackSendMessage(delegateSendMessage sendMessage); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_Loop", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void Loop(); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_DecodeAsXML", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int DecodeAsXML(char* inMessageRaw, UInt16 inMessageLength, IntPtr outMessageXML, UInt32 outMessageMaxLength); - - #endregion - - #region Server BACnet functions - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_AddDevice", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool AddDevice(UInt32 deviceInstance); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_AddObject", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool AddObject(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SetServiceEnabled", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SetServiceEnabled(UInt32 deviceInstance, UInt32 service, [In, MarshalAs(UnmanagedType.I1)] bool enabled); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_AddElevatorGroupObject", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool AddElevatorGroupObject(UInt32 deviceInstance, UInt32 objectInstance, UInt32 machineRoomId, Byte groupId, [In, MarshalAs(UnmanagedType.I1)] bool isGroupOfLifts, [In, MarshalAs(UnmanagedType.I1)] bool supportLandingCallStatus); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_AddLiftOrEscalatorObject", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool AddLiftOrEscalatorObject(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 elevatorGroupInstance, Byte groupId, Byte installationId); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SetLiftHigherLowerDeck", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SetLiftHigherLowerDeck(UInt32 deviceInstance, UInt32 objectInstance, UInt32 higherDeckObjectInstance, UInt32 lowerDeckObjectInstance); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SetPropertyWritable", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SetPropertyWritable(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool writable); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SetPropertyEnabled", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SetPropertyEnabled(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool enabled); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SetPropertyByObjectTypeEnabled", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SetPropertyByObjectTypeEnabled(UInt32 deviceInstance, UInt16 objectType, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool enabled); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_ValueUpdated", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void ValueUpdated(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier); - #endregion - - #region RegisterCallbackGetProperty - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyCharacterString", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertyCharacterString(delegateCallbackGetPropertyCharString callbackGetPropertyCharString); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyReal", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertyReal(delegateCallbackGetPropertyReal callbackGetPropertyReal); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyBool", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertyBool(delegateCallbackGetPropertyBool callbackGetPropertyBool); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetSystemTime", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetSystemTime(delegateCallbackGetSystemTime CallbackGetSystemTime); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyEnumerated", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertyEnumerated(delegateCallbackGetEnumerated callbackGetEnumerated); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyDate", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertyDate(delegateCallbackGetPropertyDate callbackGetPropertyDate); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyDouble", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertyDouble(delegateCallbackGetPropertyDouble callbackGetPropertyDouble); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyOctetString", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertyOctetString(delegateCallbackGetPropertyOctetString callbackGetPropertyOctetString); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertySignedInteger", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertySignedInteger(delegateCallbackGetPropertySignedInteger callbackGetPropertySignedInteger); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyTime", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertyTime(delegateCallbackGetPropertyTime callbackGetPropertyTime); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyUnsignedInteger", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetPropertyUnsignedInteger(delegateCallbackGetPropertyUnsignedInteger callbackGetPropertyUnsignedInteger); - - - - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetListOfEnumerations", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetListOfEnumerations(delegateCallbackGetListOfEnumerations callbackGetListOfEnumerations); - - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetListElevatorGroupLandingCall", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackGetListElevatorGroupLandingCall(delegateCallbackGetListElevatorGroupLandingCall callbackGetListElevatorGroupLandingCall); - - - #endregion - - #region RegisterCallbackSetProperty - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyReal", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void RegisterCallbackSetPropertyReal(delegateCallbackSetPropertyReal callbackSetPropertyReal); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyEnumerated", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyEnumerated(delegateCallbackSetPropertyEnumerated callbackSetPropertyEnumerated); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyBitString", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyBitString(delegateCallbackSetPropertyBitString callbackSetPropertyBitString); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyBool", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyBool(delegateCallbackSetPropertyBool callbackSetPropertyBool); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyCharacterString", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyCharacterString(delegateCallbackSetPropertyCharacterString callbackSetPropertyCharacterString); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyDate", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyDate(delegateCallbackSetPropertyDate callbackSetPropertyDate); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyDouble", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyDouble(delegateCallbackSetPropertyDouble callbackSetPropertyDouble); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyNull", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyNull(delegateCallbackSetPropertyNull callbackSetPropertyNull); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyOctetString", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyOctetString(delegateCallbackSetPropertyOctetString callbackSetPropertyOctetString); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertySignedInteger", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertySignedInteger(delegateCallbackSetPropertySignedInteger callbackSetPropertySignedInteger); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyTime", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyTime(delegateCallbackSetPropertyTime callbackSetPropertyTime); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetPropertyUnsignedInteger", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetPropertyUnsignedInteger(delegateCallbackSetPropertyUnsignedInteger callbackSetPropertyUnsignedInteger); - #endregion - - #region Client functions - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendRegisterForeignDevice", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendRegisterForeignDevice(UInt16 timeToLive, Byte* connectionString, Byte connectionStringLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendSubscribeCOV", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendSubscribeCOV(Byte* sentInvokeId, UInt32 subscriberProcessIdentifier, UInt16 monitoredObjectType, UInt32 monitoredObjectInstance, [In, MarshalAs(UnmanagedType.I1)] bool issueConfirmedNotifications, UInt32 lifetime, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendCancelSubscribeCOV", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendCancelSubscribeCOV(Byte* sentInvokeId, UInt32 subscriberProcessIdentifier, UInt16 monitoredObjectType, UInt32 monitoredObjectInstance, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_BuildReadProperty", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool BuildReadProperty(UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool usePropertyArrayIndex, UInt32 propertyArrayIndex); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_ClearReadProperty", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool ClearReadProperty(); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendReadProperty", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendReadProperty(Byte* sentInvokeId, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_BuildWriteProperty", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool BuildWriteProperty(Byte datatype, IntPtr value, UInt32 length, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool usePropertyArrayIndex, UInt32 propertyArrayIndex, [In, MarshalAs(UnmanagedType.I1)] bool usePriority, Byte priority); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_ClearWriteProperty", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool ClearWriteProperty(); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendWriteProperty", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendWriteProperty(Byte* sentInvokeId, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_BuildCreateObjectInitialPropertyValues", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool BuildCreateObjectInitialPropertyValues(UInt32 propertyIdentifier, Byte datatype, char* value, UInt32 length); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_ClearCreateObjectInitialPropertyValues", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool ClearCreateObjectInitialPropertyValues(); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendCreateObjectByType", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendCreateObjectByType(Byte* sentInvokeId, UInt16 objectType, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendCreateObjectByIdentifier", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendCreateObjectByIdentifier(Byte* sentInvokeId, UInt16 objectType, UInt32 objectInstance, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendDeleteObject", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendDeleteObject(Byte* sentInvokeId, UInt16 objectType, UInt32 objectInstance, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendReadRange", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendReadRange(Byte* sentInvokeId, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool usePropertyArrayIndex, UInt32 propertyArrayIndex, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendReadRangeByPosition", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendReadRangeByPosition(Byte* sentInvokeId, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool usePropertyArrayIndex, UInt32 propertyArrayIndex, UInt32 referenceIndex, Int16 count, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendReadRangeBySequenceNumber", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendReadRangeBySequenceNumber(Byte* sentInvokeId, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool usePropertyArrayIndex, UInt32 propertyArrayIndex, UInt32 referenceSequenceNumber, Int16 count, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendReadRangeByTime", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendReadRangeByTime(Byte* sentInvokeId, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool usePropertyArrayIndex, UInt32 propertyArrayIndex, Byte referenceYear, Byte referenceMonth, Byte referenceDay, Byte referenceWeekday, Byte referenceHour, Byte referenceMinute, Byte referenceSecond, Byte referenceHundrethSecond, Int16 count, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendIAm", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendIAm(UInt32 deviceInstance, Byte* connectionString, Byte connectionStringLength, Byte networkType, [In, MarshalAs(UnmanagedType.I1)] bool broadcast, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendWhoIs", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendWhoIs(Byte* connectionString, Byte connectionStringLength, Byte networkType, [In, MarshalAs(UnmanagedType.I1)] bool broadcast, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendWhoIsWithLimits", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendWhoIsWithLimits(UInt32 deviceInstanceRangeLowLimit, UInt32 deviceInstanceRangeHighLimit, Byte* connectionString, Byte connectionStringLength, Byte networkType, [In, MarshalAs(UnmanagedType.I1)] bool broadcast, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendWhoHasWithObjectIdentifier", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendWhoHasWithObjectIdentifier(UInt16 objectType, UInt32 objectInstance, Byte* connectionString, Byte connectionStringLength, Byte networkType, [In, MarshalAs(UnmanagedType.I1)] bool broadcast, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendWhoHasWithObjectName", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendWhoHasWithObjectName(char* objectName, UInt32 objectNameLength, Byte* connectionString, Byte connectionStringLength, Byte networkType, [In, MarshalAs(UnmanagedType.I1)] bool broadcast, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendTimeSynchronization", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendTimeSynchronization(Byte year, Byte month, Byte day, Byte weekday, Byte hour, Byte minute, Byte second, Byte hundrethSeconds, Byte* connectionString, Byte connectionStringLength, Byte networkType, [In, MarshalAs(UnmanagedType.I1)] bool broadcast, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendUTCTimeSynchronization", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool SendUTCTimeSynchronization(Byte year, Byte month, Byte day, Byte weekday, Byte hour, Byte minute, Byte second, Byte hundrethSeconds, Byte* connectionString, Byte connectionStringLength, Byte networkType, [In, MarshalAs(UnmanagedType.I1)] bool broadcast, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength); - #endregion - - #region Client callbacks - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookIAm(UInt32 deviceIdentifier, UInt32 maxApduLengthAccepted, System.Byte segmentationSupported, UInt16 vendorIdentifier, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookIAm", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookIAm(delegateHookIAm FPHookIAm); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookIHave(UInt32 deviceIdentifier, UInt16 objectType, UInt32 objectInstance, char* objectName, UInt32 objectNameLength, System.Byte objectNameEncoding, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookIHave", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookIHave(delegateHookIHave fpHookIHave); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookError(System.Byte originalInvokeId, UInt32 errorChoice, UInt32 errorClass, UInt32 errorCode, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength, bool useObjectProperty, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookError", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookError(delegateHookError fpHookError); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookReject(System.Byte originalInvokeId, UInt32 rejectReason, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookReject", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookReject(delegateHookReject fpHookReject); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookAbort(System.Byte originalInvokeId, bool sentByServer, UInt32 abortReason, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookAbort", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookAbort(delegateHookAbort fpHookAbort); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookSimpleAck(System.Byte originalInvokeId, UInt32 serverAckChoice, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookSimpleAck", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookSimpleAck(delegateHookSimpleAck fpHookSimpleAck); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookTimeout(System.Byte originalInvokeId, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookTimeout", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookTimeout(delegateHookTimeout fpHookTimeout); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyBitString(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, bool* value, UInt32 length, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyBitString", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyBitString(delegateHookPropertyBitString fpHookPropertyBitString); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyBool(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, bool value, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyBool", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyBool(delegateHookPropertyBool fpHookPropertyBool); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyCharString(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, char* value, UInt32 length, System.Byte encoding, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyCharString", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyCharString(delegateHookPropertyCharString fpHookPropertyCharString); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyDate(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, System.Byte year, System.Byte month, System.Byte day, System.Byte weekday, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyDate", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyDate(delegateHookPropertyDate fpHookPropertyDate); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyDouble(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, double value, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyDouble", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyDouble(delegateHookPropertyDouble fpHookPropertyDouble); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyEnum(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, UInt32 value, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyEnum", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyEnum(delegateHookPropertyEnum fpHookPropertyEnum); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyNull(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyNull", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyNull(delegateHookPropertyNull fpHookPropertyNull); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyObjectIdentifier(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, UInt16 objectTypeValue, UInt32 objectInstanceValue, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyObjectIdentifier", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyObjectIdentifier(delegateHookPropertyObjectIdentifier fpHookPropertyObjectIdentifier); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyOctString(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, System.Byte* value, UInt32 length, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyOctString", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyOctString(delegateHookPropertyOctString fpHookPropertyOctString); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyInt(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, Int32 value, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyInt", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyInt(delegateHookPropertyInt fpHookPropertyInt); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyReal(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, float value, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyReal", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyReal(delegateHookPropertyReal fpHookPropertyReal); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyTime(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, System.Byte hour, System.Byte minute, System.Byte second, System.Byte hundrethSecond, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyTime", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyTime(delegateHookPropertyTime fpHookPropertyTime); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void delegateHookPropertyUInt(UInt32 id, System.Byte service, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool usePropertyArrayIndex, UInt32 propertyArrayIndex, UInt32 value, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, UInt16 network, System.Byte* sourceAddress, System.Byte sourceAddressLength); - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterHookPropertyUInt", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern void BACnetStack_RegisterHookPropertyUInt(delegateHookPropertyUInt fpHookPropertyUInt); - #endregion - - - - - /* - // Server - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_EnableVirtualRouter", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int EnableVirtualRouter(); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_AddNetworkPortObject", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int AddNetworkPortObject(); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SetObjectTypeCreatable", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int SetObjectTypeCreatable(); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SetObjectTypeSupported", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int SetObjectTypeSupported(); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RemoveDevice", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RemoveDevice(); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RemoveObject", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RemoveObject(); - - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackSetSystemTime", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackSetSystemTime(); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackGetPropertyBitString", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackGetPropertyBitString(); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackCreateObject", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackCreateObject(); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_RegisterCallbackDeleteObject", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int RegisterCallbackDeleteObject(); - */ - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SetPropertyByObjectTypeSubscribable", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int SetPropertySubscribable(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool subscribable); - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SetPropertyByObjectTypeSubscribable", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern int SetPropertyByObjectTypeSubscribable(UInt32 deviceInstance, UInt16 objectType, UInt32 propertyIdentifier, bool subscribable); - - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendReadPropertyAsync", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool BACnetStack_SendReadPropertyAsync(Byte* sentInvokeId, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength, Byte propertyArraysCount, Byte* propertyArrays); - - public class ReadPropertyAsync - { - public System.Byte flags; - public System.UInt16 objectType; - public System.UInt32 objectInstance; - public System.UInt32 propertyIdentifier; - public System.UInt32 propertyArrayIndex; - - public static int SIZE_OF_ARRAY = (1 + 2 + 4 + 4 + 4); - public System.Byte[] ToBytes() - { - /* - * 120 bits (15 BYTES) - * *-[0]-----------*-[1][2]--------------*-[3][4][5][6]------------*-[7][8][9][10]---------------*-[11][12][13][14]------------* - * | uint8_t flags | uint16_t objectType | uint32_t objectInstance | uint32_t propertyIdentifier | uint32_t propertyArrayIndex | - * *---------------*---------------------*-------------------------*-----------------------------*-----------------------------* - */ - System.Byte[] ret = new System.Byte[SIZE_OF_ARRAY]; - ret[0] = this.flags; - System.Buffer.BlockCopy(BitConverter.GetBytes(this.objectType), 0, ret, 1, sizeof(System.UInt16) ); - System.Buffer.BlockCopy(BitConverter.GetBytes(this.objectInstance), 0, ret, 3, sizeof(System.UInt32)); - System.Buffer.BlockCopy(BitConverter.GetBytes(this.propertyIdentifier), 0, ret, 7, sizeof(System.UInt32)); - System.Buffer.BlockCopy(BitConverter.GetBytes(this.propertyArrayIndex), 0, ret, 11, sizeof(System.UInt32)); - - if(! BitConverter.IsLittleEndian ) - { - // BACnet is little endian. We need to swap the bytes. - Array.Reverse(ret, 1, sizeof(System.UInt16)); - Array.Reverse(ret, 3, sizeof(System.UInt32)); - Array.Reverse(ret, 7, sizeof(System.UInt32)); - Array.Reverse(ret, 11, sizeof(System.UInt32)); - } - - return ret; - } - public static byte* PointerData(byte[] safe) - { - fixed (byte* converted = safe) - { - return converted; - } - } - }; - public static bool SendReadPropertyAsync(Byte* sentInvokeId, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength, ReadPropertyAsync[] readPropertyAsyncValues) - { - if(readPropertyAsyncValues.Length <= 0 ) - { - // Nothing to do - return false; - } - - // Calualte the size of the byte array. - byte[] valuesAsBytes = new byte[readPropertyAsyncValues.Length * (ReadPropertyAsync.SIZE_OF_ARRAY)]; - - // Loop thought the list of requests and generate the BYTE array - for(int offset = 0; offset < readPropertyAsyncValues.Length; offset++ ) - { - System.Buffer.BlockCopy(readPropertyAsyncValues[offset].ToBytes(), 0, valuesAsBytes, offset * ReadPropertyAsync.SIZE_OF_ARRAY, ReadPropertyAsync.SIZE_OF_ARRAY); - } - - return BACnetStack_SendReadPropertyAsync(sentInvokeId, connectionString, connectionStringLength, networkType, network, destinationAddress, destinationAddressLength, System.Convert.ToByte(readPropertyAsyncValues.Length), ReadPropertyAsync.PointerData(valuesAsBytes)); - } - - [DllImport(BACNET_API_DLL_FILENAME, EntryPoint = "BACnetStack_SendWritePropertyAsync", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] - public static extern bool BACnetStack_SendWritePropertyAsync(Byte* sentInvokeId, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength, Byte propertyArraysCount, Byte* propertyArrays); - - public class WritePropertyAsync - { - public System.Byte flags; - public System.UInt16 objectType; - public System.UInt32 objectInstance; - public System.UInt32 propertyIdentifier; - public System.UInt32 propertyArrayIndex; - public System.Byte dataType; - public System.Byte priority; - public System.String valueAsString; - - public int GetArraySize() - { - return 1 + 2 + 4 + 4 + 4 + 1 + 1 + 2 + valueAsString.Length; - } - public System.Byte[] ToBytes() - { - /* - * - * ??? bits (?? BYTES) - * *-[0]-----------*-[1][2]--------------*-[3][4][5][6]------------*-[7][8][9][10]---------------*-[11][12][13][14]------------*-[15]-------------*-[16]-------------*-[17][18]-------------*-[19+]- Variable -----* - * | uint8_t flags | uint16_t objectType | uint32_t objectInstance | uint32_t propertyIdentifier | uint32_t propertyArrayIndex | uint8_t dataType | uint8_t priority | uint16_t valueLength | char * valueAsString | - * *---------------*---------------------*-------------------------*-----------------------------*-----------------------------*------------------*------------------*----------------------*----------------------* - * - */ - - System.Byte[] ret = new System.Byte[GetArraySize()]; - ret[0] = this.flags; - System.Buffer.BlockCopy(BitConverter.GetBytes(this.objectType), 0, ret, 1, sizeof(System.UInt16)); - System.Buffer.BlockCopy(BitConverter.GetBytes(this.objectInstance), 0, ret, 3, sizeof(System.UInt32)); - System.Buffer.BlockCopy(BitConverter.GetBytes(this.propertyIdentifier), 0, ret, 7, sizeof(System.UInt32)); - System.Buffer.BlockCopy(BitConverter.GetBytes(this.propertyArrayIndex), 0, ret, 11, sizeof(System.UInt32)); - System.Buffer.BlockCopy(BitConverter.GetBytes(this.dataType), 0, ret, 15, sizeof(System.Byte)); - System.Buffer.BlockCopy(BitConverter.GetBytes(this.priority), 0, ret, 16, sizeof(System.Byte)); - System.Buffer.BlockCopy(BitConverter.GetBytes((System.UInt16) this.valueAsString.Length), 0, ret, 17, sizeof(System.UInt16)); - System.Buffer.BlockCopy(Encoding.ASCII.GetBytes(valueAsString), 0, ret, 19, this.valueAsString.Length); - - if (!BitConverter.IsLittleEndian) - { - // BACnet is little endian. We need to swap the bytes. - Array.Reverse(ret, 1, sizeof(System.UInt16)); - Array.Reverse(ret, 3, sizeof(System.UInt32)); - Array.Reverse(ret, 7, sizeof(System.UInt32)); - Array.Reverse(ret, 11, sizeof(System.UInt32)); - Array.Reverse(ret, 17, sizeof(System.UInt16)); - } - - return ret; - } - public static byte* PointerData(byte[] safe) - { - fixed (byte* converted = safe) - { - return converted; - } - } - }; - - public static bool SendWritePropertyAsync(Byte* sentInvokeId, Byte* connectionString, Byte connectionStringLength, Byte networkType, UInt16 network, Byte* destinationAddress, Byte destinationAddressLength, WritePropertyAsync[] writePropertyAsyncValues) - { - if (writePropertyAsyncValues.Length <= 0) - { - // Nothing to do - return false; - } - - // Calualte the size of the byte array. - int valuesAsBytesLength = 0; - for (int offset = 0; offset < writePropertyAsyncValues.Length; offset++) - { - valuesAsBytesLength += writePropertyAsyncValues[offset].GetArraySize(); - } - byte[] valuesAsBytes = new byte[valuesAsBytesLength]; - - // Loop thought the list of requests and generate the BYTE array - int valuesAsBytesOffset = 0; - for (int offset = 0; offset < writePropertyAsyncValues.Length; offset++) - { - System.Buffer.BlockCopy(writePropertyAsyncValues[offset].ToBytes(), 0, valuesAsBytes, valuesAsBytesOffset, writePropertyAsyncValues[offset].GetArraySize()); - valuesAsBytesOffset += writePropertyAsyncValues[offset].GetArraySize(); - } - - return BACnetStack_SendWritePropertyAsync(sentInvokeId, connectionString, connectionStringLength, networkType, network, destinationAddress, destinationAddressLength, System.Convert.ToByte(writePropertyAsyncValues.Length), ReadPropertyAsync.PointerData(valuesAsBytes)); - } - } -} diff --git a/BACnetServerExample/BACnetServerExample/CIBuildVersion.cs b/BACnetServerExample/BACnetServerExample/CIBuildVersion.cs deleted file mode 100644 index 63d51a0..0000000 --- a/BACnetServerExample/BACnetServerExample/CIBuildVersion.cs +++ /dev/null @@ -1,2 +0,0 @@ -// This file is overwritten during the CI Build phase. -namespace BACnetServerExample { static class CIBuildVersion { public const int CIBUILDNUMBER = 0; } } \ No newline at end of file diff --git a/BACnetServerExample/BACnetServerExample/Program.cs b/BACnetServerExample/BACnetServerExample/Program.cs deleted file mode 100644 index d20cf51..0000000 --- a/BACnetServerExample/BACnetServerExample/Program.cs +++ /dev/null @@ -1,960 +0,0 @@ -/** - * Windows BACnet Server Example CSharp - * ---------------------------------------------------------------------------- - * In this CAS BACnet Stack example, we create a BACnet IP server with the basic object types. - * - * More information https://github.com/chipkin/Windows-BACnetServerExampleCSharp - * - * Created by: Steven Smethurst - * Created on: June 7, 2019 - * Last updated: June 7, 2019 - */ - - -using BACnetStackDLLServerCSharpExample; -using System; -using System.Net; -using System.Net.Sockets; -using System.Runtime.InteropServices; -using System.Text; - -namespace BACnetServerExample -{ - class Program - { - static void Main(string[] args) - { - BACnetServer bacnetServer = new BACnetServer(); - bacnetServer.Run(); - } - - unsafe class BACnetServer - { - // UDP - UdpClient udpServer; - IPEndPoint RemoteIpEndPoint; - - // Settings - const UInt16 SETTING_BACNET_PORT = 47808; - - // A Database to hold the current state of the - private ExampleDatabase database = new ExampleDatabase(); - - // Version - const string APPLICATION_VERSION = "0.0.1"; - - public void Run() - { - Console.WriteLine("Starting Windows-BACnetServerExampleCSharp version{0}.{1}", APPLICATION_VERSION, CIBuildVersion.CIBUILDNUMBER); - Console.WriteLine("https://github.com/chipkin/Windows-BACnetServerExampleCSharp"); - Console.WriteLine("FYI: BACnet Stack version: {0}.{1}.{2}.{3}", - CASBACnetStackAdapter.GetAPIMajorVersion(), - CASBACnetStackAdapter.GetAPIMinorVersion(), - CASBACnetStackAdapter.GetAPIPatchVersion(), - CASBACnetStackAdapter.GetAPIBuildVersion()); - - // Send/Recv callbacks. - CASBACnetStackAdapter.RegisterCallbackSendMessage(SendMessage); - CASBACnetStackAdapter.RegisterCallbackReceiveMessage(RecvMessage); - CASBACnetStackAdapter.RegisterCallbackGetSystemTime(CallbackGetSystemTime); - - // Get Datatype Callbacks - CASBACnetStackAdapter.RegisterCallbackGetPropertyCharacterString(CallbackGetPropertyCharString); - CASBACnetStackAdapter.RegisterCallbackGetPropertyReal(CallbackGetPropertyReal); - CASBACnetStackAdapter.RegisterCallbackGetPropertyEnumerated(CallbackGetEnumerated); - CASBACnetStackAdapter.RegisterCallbackGetPropertyUnsignedInteger(CallbackGetUnsignedInteger); - CASBACnetStackAdapter.RegisterCallbackGetPropertyBool(CallbackGetPropertyBool); - CASBACnetStackAdapter.RegisterCallbackGetPropertyDate(CallbackGetPropertyDate); - CASBACnetStackAdapter.RegisterCallbackGetPropertyDouble(CallbackGetPropertyDouble); - CASBACnetStackAdapter.RegisterCallbackGetPropertySignedInteger(CallbackGetPropertySignedInteger); - CASBACnetStackAdapter.RegisterCallbackGetPropertyTime(CallbackGetPropertyTime); - // NULL - CASBACnetStackAdapter.RegisterCallbackGetPropertyOctetString(CallbackGetPropertyOctetString); - // BitString - - // Set Datatype Callbacks - CASBACnetStackAdapter.RegisterCallbackSetPropertyCharacterString(CallbackSetPropertyCharacterString); - CASBACnetStackAdapter.RegisterCallbackSetPropertyReal(CallbackSetPropertyReal); - CASBACnetStackAdapter.RegisterCallbackSetPropertyEnumerated(CallbackSetPropertyEnumerated); - CASBACnetStackAdapter.RegisterCallbackSetPropertyUnsignedInteger(CallbackSetPropertyUnsignedInteger); - CASBACnetStackAdapter.RegisterCallbackSetPropertyBool(CallbackSetPropertyBool); - CASBACnetStackAdapter.RegisterCallbackSetPropertyDate(CallbackSetPropertyDate); - CASBACnetStackAdapter.RegisterCallbackSetPropertyDouble(CallbackSetPropertyDouble); - CASBACnetStackAdapter.RegisterCallbackSetPropertySignedInteger(CallbackSetPropertySignedInteger); - CASBACnetStackAdapter.RegisterCallbackSetPropertyTime(CallbackSetPropertyTime); - CASBACnetStackAdapter.RegisterCallbackSetPropertyNull(CallbackSetPropertyNull); - CASBACnetStackAdapter.RegisterCallbackSetPropertyOctetString(CallbackSetPropertyOctetString); - CASBACnetStackAdapter.RegisterCallbackSetPropertyBitString(CallbackSetPropertyBitString); - - - this.database.Setup(); - - // Add the device. - CASBACnetStackAdapter.AddDevice(this.database.Device.instance); - - // AnalogInput - for (UInt32 offset = 0; offset < this.database.AnalogInput.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_INPUT, offset); - } - CASBACnetStackAdapter.SetPropertyByObjectTypeEnabled(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_INPUT, CASBACnetStackAdapter.PROPERTY_IDENTIFIER_DESCRIPTION, true); - CASBACnetStackAdapter.SetPropertyByObjectTypeSubscribable(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_INPUT, CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE, true); - - - // AnalogOutput - for (UInt32 offset = 0; offset < this.database.AnalogOutput.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_OUTPUT, offset); - } - - // AnalogValue - for (UInt32 offset = 0; offset < this.database.AnalogValue.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_VALUE, offset); - CASBACnetStackAdapter.SetPropertyWritable(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_VALUE, offset, CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE, true); - } - - // BinaryInput - for (UInt32 offset = 0; offset < this.database.BinaryInput.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_BINARY_INPUT, offset); - } - - // BinaryValue - for (UInt32 offset = 0; offset < this.database.BinaryValue.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_BINARY_VALUE, offset); - CASBACnetStackAdapter.SetPropertyWritable(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_BINARY_VALUE, offset, CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE, true); - } - // MultiStateInput - for (UInt32 offset = 0; offset < this.database.MultiStateInput.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_INPUT, offset); - } - CASBACnetStackAdapter.SetPropertyByObjectTypeEnabled(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_INPUT, CASBACnetStackAdapter.PROPERTY_IDENTIFIER_STATETEXT, true); - - // MultiStateValue - for (UInt32 offset = 0; offset < this.database.MultiStateValue.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_VALUE, offset); - CASBACnetStackAdapter.SetPropertyWritable(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_VALUE, offset, CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE, true); - } - CASBACnetStackAdapter.SetPropertyByObjectTypeEnabled(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_VALUE, CASBACnetStackAdapter.PROPERTY_IDENTIFIER_STATETEXT, true); - - // CharacterString - for (UInt32 offset = 0; offset < this.database.CharacterString.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_CHARACTERSTRING_VALUE, offset); - } - - // PositiveIntergerValue - for (UInt32 offset = 0; offset < this.database.PositiveIntergerValue.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_POSITIVE_INTEGER_VALUE, offset); - } - - // DateValue - for (UInt32 offset = 0; offset < this.database.DateValue.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_DATE_VALUE, offset); - } - - // TimeValue - for (UInt32 offset = 0; offset < this.database.TimeValue.Length; offset++) - { - CASBACnetStackAdapter.AddObject(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_TIME_VALUE, offset); - } - - // Enable optional services - CASBACnetStackAdapter.SetServiceEnabled(database.Device.instance, CASBACnetStackAdapter.SERVICE_READ_PROPERTY_MULTIPLE, true); - CASBACnetStackAdapter.SetServiceEnabled(database.Device.instance, CASBACnetStackAdapter.SERVICE_WRITE_PROPERTY, true); - CASBACnetStackAdapter.SetServiceEnabled(database.Device.instance, CASBACnetStackAdapter.SERVICE_WRITE_PROPERTY_MULTIPLE, true); - CASBACnetStackAdapter.SetServiceEnabled(database.Device.instance, CASBACnetStackAdapter.SERVICE_SUBSCRIBE_COV, true); - - - - // All done with the BACnet setup. - Console.WriteLine("FYI: CAS BACnet Stack Setup, successfuly"); - - // Open the BACnet port to recive messages. - this.udpServer = new UdpClient(SETTING_BACNET_PORT); - this.RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0); - - // Main loop. - Console.WriteLine("FYI: Starting main loop"); - for (; ; ) - { - CASBACnetStackAdapter.Loop(); - - database.Loop(); // Just for this example - DoUserInput(); // Just for this example - } - } - - private void DoUserInput() - { - if (Console.KeyAvailable) - { - ConsoleKeyInfo key = Console.ReadKey(true); - switch (key.Key) - { - case ConsoleKey.F1: - Console.WriteLine("FYI: BACnet Stack version: {0}.{1}.{2}.{3}", - CASBACnetStackAdapter.GetAPIMajorVersion(), - CASBACnetStackAdapter.GetAPIMinorVersion(), - CASBACnetStackAdapter.GetAPIPatchVersion(), - CASBACnetStackAdapter.GetAPIBuildVersion()); - break; - case ConsoleKey.UpArrow: - if (this.database.AnalogInput.Length > 0) - { - this.database.AnalogInput[0].presentValue += 0.01f; - Console.WriteLine("FYI: Incurment Analog input {0} present value to {1:0.00}", 0, this.database.AnalogInput[0].presentValue); - - // Notify the CAS BACnet stack that this value has been updated. - // If there are any subscribers to this value, they will be sent be sent the updated value. - CASBACnetStackAdapter.ValueUpdated(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_INPUT, 0, CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE); - } - break; - case ConsoleKey.DownArrow: - if (this.database.AnalogInput.Length > 0) - { - this.database.AnalogInput[0].presentValue -= 0.01f; - Console.WriteLine("FYI: Decrement Analog input {0} present value to {1:0.00}", 0, this.database.AnalogInput[0].presentValue); - CASBACnetStackAdapter.ValueUpdated(database.Device.instance, CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_INPUT, 0, CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE); - } - break; - default: - break; - } - } - } - - - public ulong CallbackGetSystemTime() - { - // https://stackoverflow.com/questions/9453101/how-do-i-get-epoch-time-in-c - return (ulong)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - } - public UInt16 SendMessage(System.Byte* message, UInt16 messageLength, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, Boolean broadcast) - { - if (connectionStringLength < 6 || messageLength <= 0) - { - return 0; - } - // Extract the connection string into a IP address and port. - IPAddress ipAddress = new IPAddress(new byte[] { connectionString[0], connectionString[1], connectionString[2], connectionString[3] }); - IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, (connectionString[4] + connectionString[5] * 256)); - - // Debug - Console.WriteLine("FYI: Sending {0} bytes to {1}", messageLength, ipEndPoint.ToString()); - - // Copy from the unsafe pointer to a Byte array. - byte[] sendBytes = new byte[messageLength]; - Marshal.Copy((IntPtr)message, sendBytes, 0, messageLength); - - try - { - this.udpServer.Send(sendBytes, sendBytes.Length, ipEndPoint); - return (UInt16)sendBytes.Length; - } - catch (Exception e) - { - Console.WriteLine(e.ToString()); - } - - return 0; - } - public UInt16 RecvMessage(System.Byte* message, UInt16 maxMessageLength, System.Byte* receivedConnectionString, System.Byte maxConnectionStringLength, System.Byte* receivedConnectionStringLength, System.Byte* networkType) - { - try - { - if (this.udpServer.Available > 0) - { - // Data buffer for incoming data. - byte[] receiveBytes = this.udpServer.Receive(ref this.RemoteIpEndPoint); - byte[] ipAddress = RemoteIpEndPoint.Address.GetAddressBytes(); - byte[] port = BitConverter.GetBytes(UInt16.Parse(RemoteIpEndPoint.Port.ToString())); - - // Copy from the unsafe pointer to a Byte array. - Marshal.Copy(receiveBytes, 0, (IntPtr)message, receiveBytes.Length); - - // Copy the Connection string - Marshal.Copy(ipAddress, 0, (IntPtr)receivedConnectionString, 4); - Marshal.Copy(port, 0, (IntPtr)receivedConnectionString + 4, 2); - *receivedConnectionStringLength = 6; - - // Debug - Console.WriteLine("FYI: Recving {0} bytes from {1}", receiveBytes.Length, RemoteIpEndPoint.ToString()); - - // Return length. - return (ushort)receiveBytes.Length; - } - } - catch (Exception e) - { - Console.WriteLine(e.ToString()); - } - return 0; - } - - private UInt32 UpdateStringAndReturnSize(System.Char* value, UInt32 maxElementCount, string stringAsVallue) - { - byte[] nameAsBuffer = ASCIIEncoding.ASCII.GetBytes(stringAsVallue); - UInt32 valueElementCount = maxElementCount; - if (nameAsBuffer.Length < valueElementCount) - { - valueElementCount = Convert.ToUInt32(nameAsBuffer.Length); - } - Marshal.Copy(nameAsBuffer, 0, (IntPtr)value, Convert.ToInt32(valueElementCount)); - return valueElementCount; - } - - public bool CallbackGetPropertyCharString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, System.Char* value, UInt32* valueElementCount, UInt32 maxElementCount, System.Byte encodingType, bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetPropertyCharString. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - - switch (objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_DEVICE: - if (deviceInstance == database.Device.instance && objectInstance == database.Device.instance) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.Device.name); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_MODEL_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.Device.modelName); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_VENDOR_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.Device.vendorName); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_APPLICATIONSOFTWAREVERSION) - { - string version = APPLICATION_VERSION + "." + CIBuildVersion.CIBUILDNUMBER; - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, version); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_INPUT: - if (objectInstance < database.AnalogInput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.AnalogInput[objectInstance].name); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_DESCRIPTION) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.AnalogInput[objectInstance].description); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_OUTPUT: - if (objectInstance < database.AnalogOutput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.AnalogOutput[objectInstance].name); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_VALUE: - if (objectInstance < database.AnalogValue.Length) { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.AnalogValue[objectInstance].name); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_BINARY_INPUT: - if (objectInstance < database.BinaryInput.Length) { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.BinaryInput[objectInstance].name); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_BINARY_VALUE: - if (objectInstance < database.BinaryValue.Length) { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.BinaryValue[objectInstance].name); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_INPUT: - if (objectInstance < database.MultiStateInput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.MultiStateInput[objectInstance].name); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_STATETEXT && useArrayIndex) - { - if (propertyArrayIndex <= database.MultiStateInput[objectInstance].stateText.Length) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.MultiStateInput[objectInstance].stateText[propertyArrayIndex - 1]); - return true; - } - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_VALUE: - if (objectInstance < database.MultiStateValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.MultiStateValue[objectInstance].name); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_STATETEXT && useArrayIndex) - { - if (propertyArrayIndex <= database.MultiStateValue[objectInstance].stateText.Length) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.MultiStateValue[objectInstance].stateText[propertyArrayIndex - 1]); - return true; - } - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_CHARACTERSTRING_VALUE: - if (objectInstance < database.CharacterString.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.CharacterString[objectInstance].name); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.CharacterString[objectInstance].presentValue); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_POSITIVE_INTEGER_VALUE: - if (objectInstance < database.CharacterString.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.PositiveIntergerValue[objectInstance].name); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_DATE_VALUE: - if (objectInstance < database.DateValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.DateValue[objectInstance].name); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_TIME_VALUE: - if (objectInstance < database.DateValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.TimeValue[objectInstance].name); - return true; - } - } - break; - - default: - break; - } - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; // Could not handle this request. - } - - public bool CallbackGetPropertyReal(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, float* value, bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetPropertyReal. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - - switch (objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_INPUT: - if (objectInstance < database.AnalogInput.Length) - { - *value = database.AnalogInput[objectInstance].presentValue; - Console.WriteLine("FYI: AnalogInput[{0}].value got [{1}]", objectInstance, database.AnalogInput[objectInstance].presentValue); - return true; - } - break; - - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_OUTPUT: - if (objectInstance < database.AnalogInput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRIORITY_ARRAY && useArrayIndex) - { - if (propertyArrayIndex <= database.AnalogOutput[objectInstance].priorityArrayNulls.Length) - { - *value = database.AnalogOutput[objectInstance].priorityArrayValues[propertyArrayIndex - 1]; - return true; - } - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_RELINQUISHDEFAULT ) - { - *value = database.AnalogOutput[objectInstance].relinquishDefault; - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_VALUE: - if (objectInstance < database.AnalogValue.Length) { - *value = database.AnalogValue[objectInstance].presentValue; - Console.WriteLine("FYI: AnalogValue[{0}].value got [{1}]", objectInstance, database.AnalogValue[objectInstance].presentValue); - return true; - } - break; - default: - break; - } - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - public bool CallbackGetEnumerated(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, UInt32* value, bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetEnumerated. objectType={0}, objectInstance={1}, propertyIdentifier={2}", objectType, objectInstance, propertyIdentifier); - - switch (objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_BINARY_INPUT: - if (objectInstance < database.BinaryInput.Length) { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) { - *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: - if (objectInstance < database.BinaryValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) { - *value = (UInt32)(database.BinaryValue[objectInstance].presentValue ? 1 : 0); - Console.WriteLine("FYI: BinaryValue[{0}].value got [{1}]", objectInstance, database.BinaryValue[objectInstance].presentValue); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_INPUT: - if (objectInstance < database.AnalogInput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_UNITS) - { - *value = (UInt32)(database.AnalogInput[objectInstance].units); - Console.WriteLine("FYI: AnalogInput[{0}].units got [{1}]", objectInstance, database.AnalogInput[objectInstance].units); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_VALUE: - if (objectInstance < database.AnalogValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_UNITS) - { - *value = (UInt32)(database.AnalogValue[objectInstance].units); - Console.WriteLine("FYI: AnalogValue[{0}].units got [{1}]", objectInstance, database.AnalogValue[objectInstance].units); - return true; - } - } - break; - default: - break; - } - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - - public bool CallbackGetUnsignedInteger(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, UInt32* value, bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetUnsignedInteger. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - switch (objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_DEVICE: - if (deviceInstance == database.Device.instance && objectInstance == database.Device.instance) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) - { - *value = database.Device.vendorIdentifiier; - return true; - } - } - break; - - case CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_INPUT: - if (objectInstance < database.MultiStateInput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - *value = database.MultiStateInput[objectInstance].presentValue; - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_STATETEXT && useArrayIndex && propertyArrayIndex == 0) - { - *value = Convert.ToUInt32(database.MultiStateInput[objectInstance].stateText.Length); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_NUMBEROFSTATES) - { - *value = Convert.ToUInt32(database.MultiStateInput[objectInstance].stateText.Length); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_VALUE: - if (objectInstance < database.MultiStateValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - *value = database.MultiStateValue[objectInstance].presentValue; - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_STATETEXT && useArrayIndex && propertyArrayIndex == 0) - { - *value = Convert.ToUInt32(database.MultiStateValue[objectInstance].stateText.Length); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_NUMBEROFSTATES) - { - *value = Convert.ToUInt32(database.MultiStateValue[objectInstance].stateText.Length); - return true; - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_POSITIVE_INTEGER_VALUE: - if (objectInstance < database.PositiveIntergerValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - *value = database.PositiveIntergerValue[objectInstance].presentValue; - return true; - } - } - break; - default: - break; - } - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - - public bool CallbackGetPropertyBool(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool* value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetPropertyBool. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - - switch (objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_INPUT: - if (objectInstance < database.AnalogInput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OUT_OF_SERVICE) - { - *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: - if (objectInstance < database.AnalogOutput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OUT_OF_SERVICE) - { - *value = database.AnalogOutput[objectInstance].outOfService; - Console.WriteLine("FYI: AnalogOutput[{0}].outOfService got [{1}]", objectInstance, database.AnalogOutput[objectInstance].outOfService); - return true; - } - else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRIORITY_ARRAY && useArrayIndex) - { - if(propertyArrayIndex <= database.AnalogOutput[objectInstance].priorityArrayNulls.Length) - { - *value = database.AnalogOutput[objectInstance].priorityArrayNulls[propertyArrayIndex - 1]; - return true; - } - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_VALUE: - if (objectInstance < database.AnalogValue.Length) - { - *value = database.AnalogValue[objectInstance].outOfService; - Console.WriteLine("FYI: AnalogValue[{0}].outOfService got [{1}]", objectInstance, database.AnalogValue[objectInstance].outOfService); - return true; - } - break; - default: - break; - } - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - - - bool CallbackGetPropertyDate(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte* year, Byte* month, Byte* day, Byte* weekday, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetPropertyDate. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - - switch( objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_DATE_VALUE: - if (objectInstance < database.DateValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - *year = database.DateValue[objectInstance].presentValueYear; - *month = database.DateValue[objectInstance].presentValueMonth; - *day = database.DateValue[objectInstance].presentValueDay; - *weekday = database.DateValue[objectInstance].presentValueWeekday; - Console.WriteLine("FYI: DateValue[{0}] got year=[{1}] month=[{2}] day=[{3}] weekday=[{4}]", objectInstance, database.DateValue[objectInstance].presentValueYear, - database.DateValue[objectInstance].presentValueMonth, database.DateValue[objectInstance].presentValueDay, database.DateValue[objectInstance].presentValueWeekday); - return true; - } - } - break; - default: - break; - } - - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackGetPropertyDouble(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Double* value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetPropertyDouble. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackGetPropertySignedInteger(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Int32* value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetPropertySignedInteger. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackGetPropertyTime(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte* hour, Byte* minute, Byte* second, Byte* hundrethSeconds, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetPropertyTime. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - - switch( objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_TIME_VALUE: - if (objectInstance < database.TimeValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - *hour = database.TimeValue[objectInstance].presentValueHour; - *minute = database.TimeValue[objectInstance].presentValueMinute; - *second = database.TimeValue[objectInstance].presentValueSecond; - *hundrethSeconds = database.TimeValue[objectInstance].presentValueHundrethSecond; - Console.WriteLine("FYI: TimeValue[{0}] got hour=[{1}] minute=[{2}] second=[{3}] hundrethSeconds=[{4}]", objectInstance, - database.TimeValue[objectInstance].presentValueHour, database.TimeValue[objectInstance].presentValueMinute, - database.TimeValue[objectInstance].presentValueSecond, database.TimeValue[objectInstance].presentValueHundrethSecond); - return true; - } - } - break; - default: - break; - } - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackGetPropertyOctetString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte* value, UInt32* valueElementCount, UInt32 maxElementCount, System.Byte encodingType, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex) - { - Console.WriteLine("FYI: Request for CallbackGetPropertyOctetString. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - - - public bool CallbackSetPropertyEnumerated(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, UInt32 value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyEnumerated. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3} value={4}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex, value); - switch (objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_BINARY_VALUE: - if (objectInstance < database.BinaryValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - database.BinaryValue[objectInstance].presentValue = (value == 1); - Console.WriteLine("FYI: BinaryValue[{0}] set to [{1}]", objectInstance, (value == 1)); - return true; - } - } - break; - default: - break; - } - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - - public bool CallbackSetPropertyReal(bool deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, float value, bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyReal. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3} value={4}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex, value); - - switch (objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_OUTPUT: - if (objectInstance < database.AnalogOutput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - if(priority <= database.AnalogOutput[objectInstance].priorityArrayNulls.Length && - priority <= database.AnalogOutput[objectInstance].priorityArrayValues.Length) - { - database.AnalogOutput[objectInstance].priorityArrayNulls[priority - 1] = false; - database.AnalogOutput[objectInstance].priorityArrayValues[priority - 1] = value; - Console.WriteLine("FYI: AnalogOutput[{0}] set to [{1}] at priorty=[{2}]", objectInstance, value, priority); - return true; - } - } - } - break; - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_VALUE: - if (objectInstance < database.AnalogValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) { - database.AnalogValue[objectInstance].presentValue = value; - Console.WriteLine("FYI: AnalogValue[{0}] set to [{1}]", objectInstance, value); - return true; - } - } - break; - default: - break; - } - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - - bool CallbackSetPropertyUnsignedInteger(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, UInt32 value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyUnsignedInteger. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3} value={4}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex, value); - - switch (objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_MULTI_STATE_VALUE: - if (objectInstance < database.MultiStateValue.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - database.MultiStateValue[objectInstance].presentValue = value; - Console.WriteLine("FYI: MultiStateValue[{0}] set to [{1}]", objectInstance, value); - return true; - } - } - break; - default: - break; - } - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - - bool CallbackSetPropertyNull(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyNull. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - - switch (objectType) - { - case CASBACnetStackAdapter.OBJECT_TYPE_ANALOG_OUTPUT: - if (objectInstance < database.AnalogOutput.Length) - { - if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_PRESENT_VALUE) - { - if(priority <= database.AnalogOutput[objectInstance].priorityArrayNulls.Length ) - { - database.AnalogOutput[objectInstance].priorityArrayNulls[priority-1] = true; - Console.WriteLine("FYI: AnalogOutput[{0}] set to [NULL] for priorty=[{1}]", objectInstance, priority); - return true; - } - } - } - break; - default: - break; - } - - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - - bool CallbackSetPropertySignedInteger(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Int32 value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertySignedInteger. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackSetPropertyDouble(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Double value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyDouble. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackSetPropertyBool(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool value, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyBool. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackSetPropertyTime(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte hour, Byte minute, Byte second, Byte hundrethSeconds, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyTime. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackSetPropertyDate(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte year, Byte month, Byte day, Byte weekday, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyDate. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackSetPropertyCharacterString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, char* value, UInt32 length, Byte encodingType, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyCharacterString. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackSetPropertyOctetString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, Byte* value, UInt32 length, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyOctetString. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - bool CallbackSetPropertyBitString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, bool* value, UInt32 length, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) - { - Console.WriteLine("FYI: Request for CallbackSetPropertyBitString. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); - Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); - return false; - } - } - } -} diff --git a/BACnetServerExample/BACnetServerExample/BACnetServerExampleDatabase.cs b/BACnetServerExample/BACnetServerExampleDatabase.cs similarity index 99% rename from BACnetServerExample/BACnetServerExample/BACnetServerExampleDatabase.cs rename to BACnetServerExample/BACnetServerExampleDatabase.cs index bdd7e29..09043c4 100644 --- a/BACnetServerExample/BACnetServerExample/BACnetServerExampleDatabase.cs +++ b/BACnetServerExample/BACnetServerExampleDatabase.cs @@ -1,4 +1,5 @@ -using BACnetStackDLLServerCSharpExample; +using BACnetServerExample; +using CASBACnetStack; using System; using System.Collections.Generic; using System.Text; diff --git a/BACnetServerExample/CIBuildVersion.cs b/BACnetServerExample/CIBuildVersion.cs new file mode 100644 index 0000000..5581bdf --- /dev/null +++ b/BACnetServerExample/CIBuildVersion.cs @@ -0,0 +1,2 @@ +// This file is overwritten during the CI Build phase. +namespace CASBACnetStack { static class CIBuildVersion { public const int CIBUILDNUMBER = 0; } } \ No newline at end of file diff --git a/BACnetServerExample/Program.cs b/BACnetServerExample/Program.cs new file mode 100644 index 0000000..c125004 --- /dev/null +++ b/BACnetServerExample/Program.cs @@ -0,0 +1,242 @@ +/** + * Windows BACnet Server Example Proprietary Property Sharp + * ---------------------------------------------------------------------------- + * A BACnet server example that shows how to add proprietary property to an object + * + * More information https://github.com/chipkin/BACnetServerExampleProprietaryPropertyCSharp + * + * Created by: Steven Smethurst + * Created on: June 24, 2019 + * Last updated: June 24, 2019 + */ + + +using CASBACnetStack; +using System; +using System.Net; +using System.Net.Sockets; +using System.Runtime.InteropServices; +using System.Text; + +namespace BACnetServerExample +{ + class Program + { + static void Main(string[] args) + { + BACnetServer bacnetServer = new BACnetServer(); + bacnetServer.Run(); + } + + unsafe class BACnetServer + { + // UDP + UdpClient udpServer; + IPEndPoint RemoteIpEndPoint; + + // Settings + const UInt16 SETTING_BACNET_PORT = 47808; + + // A Database to hold the current state of the + private ExampleDatabase database = new ExampleDatabase(); + + // Version + const string APPLICATION_VERSION = "0.0.1"; + + public void Run() + { + Console.WriteLine("Starting Windows-BACnetServerExampleProprietaryPropertyCSharp version{0}.{1}", APPLICATION_VERSION, CIBuildVersion.CIBUILDNUMBER); + Console.WriteLine("https://github.com/chipkin/BACnetServerExampleProprietaryPropertyCSharp"); + Console.WriteLine("FYI: BACnet Stack version: {0}.{1}.{2}.{3}", + CASBACnetStackAdapter.GetAPIMajorVersion(), + CASBACnetStackAdapter.GetAPIMinorVersion(), + CASBACnetStackAdapter.GetAPIPatchVersion(), + CASBACnetStackAdapter.GetAPIBuildVersion()); + + // Send/Recv callbacks. + CASBACnetStackAdapter.RegisterCallbackSendMessage(SendMessage); + CASBACnetStackAdapter.RegisterCallbackReceiveMessage(RecvMessage); + CASBACnetStackAdapter.RegisterCallbackGetSystemTime(CallbackGetSystemTime); + + // Get Datatype Callbacks + CASBACnetStackAdapter.RegisterCallbackGetPropertyCharacterString(CallbackGetPropertyCharString); + + // Set Datatype Callbacks + CASBACnetStackAdapter.RegisterCallbackSetPropertyCharacterString(CallbackSetPropertyCharacterString); + + + this.database.Setup(); + + // Add the device. + CASBACnetStackAdapter.AddDevice(this.database.Device.instance); + + // Enable optional services + CASBACnetStackAdapter.SetServiceEnabled(database.Device.instance, CASBACnetStackAdapter.SERVICE_READ_PROPERTY_MULTIPLE, true); + CASBACnetStackAdapter.SetServiceEnabled(database.Device.instance, CASBACnetStackAdapter.SERVICE_WRITE_PROPERTY, true); + CASBACnetStackAdapter.SetServiceEnabled(database.Device.instance, CASBACnetStackAdapter.SERVICE_WRITE_PROPERTY_MULTIPLE, true); + + // All done with the BACnet setup. + Console.WriteLine("FYI: CAS BACnet Stack Setup, successfuly"); + + // Open the BACnet port to recive messages. + this.udpServer = new UdpClient(SETTING_BACNET_PORT); + this.RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0); + + // Main loop. + Console.WriteLine("FYI: Starting main loop"); + for (; ; ) + { + CASBACnetStackAdapter.Loop(); + database.Loop(); // Just for this example + } + } + + private void DoUserInput() + { + if (Console.KeyAvailable) + { + ConsoleKeyInfo key = Console.ReadKey(true); + switch (key.Key) + { + case ConsoleKey.F1: + Console.WriteLine("FYI: BACnet Stack version: {0}.{1}.{2}.{3}", + CASBACnetStackAdapter.GetAPIMajorVersion(), + CASBACnetStackAdapter.GetAPIMinorVersion(), + CASBACnetStackAdapter.GetAPIPatchVersion(), + CASBACnetStackAdapter.GetAPIBuildVersion()); + break; + default: + break; + } + } + } + + + public ulong CallbackGetSystemTime() + { + // https://stackoverflow.com/questions/9453101/how-do-i-get-epoch-time-in-c + return (ulong)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + } + public UInt16 SendMessage(System.Byte* message, UInt16 messageLength, System.Byte* connectionString, System.Byte connectionStringLength, System.Byte networkType, Boolean broadcast) + { + if (connectionStringLength < 6 || messageLength <= 0) + { + return 0; + } + // Extract the connection string into a IP address and port. + IPAddress ipAddress = new IPAddress(new byte[] { connectionString[0], connectionString[1], connectionString[2], connectionString[3] }); + IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, (connectionString[4] + connectionString[5] * 256)); + + // Debug + Console.WriteLine("FYI: Sending {0} bytes to {1}", messageLength, ipEndPoint.ToString()); + + // Copy from the unsafe pointer to a Byte array. + byte[] sendBytes = new byte[messageLength]; + Marshal.Copy((IntPtr)message, sendBytes, 0, messageLength); + + try + { + this.udpServer.Send(sendBytes, sendBytes.Length, ipEndPoint); + return (UInt16)sendBytes.Length; + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + + return 0; + } + public UInt16 RecvMessage(System.Byte* message, UInt16 maxMessageLength, System.Byte* receivedConnectionString, System.Byte maxConnectionStringLength, System.Byte* receivedConnectionStringLength, System.Byte* networkType) + { + try + { + if (this.udpServer.Available > 0) + { + // Data buffer for incoming data. + byte[] receiveBytes = this.udpServer.Receive(ref this.RemoteIpEndPoint); + byte[] ipAddress = RemoteIpEndPoint.Address.GetAddressBytes(); + byte[] port = BitConverter.GetBytes(UInt16.Parse(RemoteIpEndPoint.Port.ToString())); + + // Copy from the unsafe pointer to a Byte array. + Marshal.Copy(receiveBytes, 0, (IntPtr)message, receiveBytes.Length); + + // Copy the Connection string + Marshal.Copy(ipAddress, 0, (IntPtr)receivedConnectionString, 4); + Marshal.Copy(port, 0, (IntPtr)receivedConnectionString + 4, 2); + *receivedConnectionStringLength = 6; + + // Debug + Console.WriteLine("FYI: Recving {0} bytes from {1}", receiveBytes.Length, RemoteIpEndPoint.ToString()); + + // Return length. + return (ushort)receiveBytes.Length; + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + return 0; + } + + private UInt32 UpdateStringAndReturnSize(System.Char* value, UInt32 maxElementCount, string stringAsVallue) + { + byte[] nameAsBuffer = ASCIIEncoding.ASCII.GetBytes(stringAsVallue); + UInt32 valueElementCount = maxElementCount; + if (nameAsBuffer.Length < valueElementCount) + { + valueElementCount = Convert.ToUInt32(nameAsBuffer.Length); + } + Marshal.Copy(nameAsBuffer, 0, (IntPtr)value, Convert.ToInt32(valueElementCount)); + return valueElementCount; + } + + public bool CallbackGetPropertyCharString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, System.Char* value, UInt32* valueElementCount, UInt32 maxElementCount, System.Byte encodingType, bool useArrayIndex, UInt32 propertyArrayIndex) + { + Console.WriteLine("FYI: Request for CallbackGetPropertyCharString. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); + + switch (objectType) + { + case CASBACnetStackAdapter.OBJECT_TYPE_DEVICE: + if (deviceInstance == database.Device.instance && objectInstance == database.Device.instance) + { + if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_OBJECT_NAME) + { + *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.Device.name); + return true; + } + else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_MODEL_NAME) + { + *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.Device.modelName); + return true; + } + else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_VENDOR_NAME) + { + *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, database.Device.vendorName); + return true; + } + else if (propertyIdentifier == CASBACnetStackAdapter.PROPERTY_IDENTIFIER_APPLICATIONSOFTWAREVERSION) + { + string version = APPLICATION_VERSION + "." + CIBuildVersion.CIBUILDNUMBER; + *valueElementCount = UpdateStringAndReturnSize(value, maxElementCount, version); + return true; + } + } + break; + default: + break; + } + + Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); + return false; // Could not handle this request. + } + + bool CallbackSetPropertyCharacterString(UInt32 deviceInstance, UInt16 objectType, UInt32 objectInstance, UInt32 propertyIdentifier, char* value, UInt32 length, Byte encodingType, [In, MarshalAs(UnmanagedType.I1)] bool useArrayIndex, UInt32 propertyArrayIndex, System.Byte priority, UInt32* errorCode) + { + Console.WriteLine("FYI: Request for CallbackSetPropertyCharacterString. objectType={0}, objectInstance={1}, propertyIdentifier={2}, propertyArrayIndex={3}", objectType, objectInstance, propertyIdentifier, propertyArrayIndex); + Console.WriteLine(" FYI: Not implmented. propertyIdentifier={0}", propertyIdentifier); + return false; + } + } + } +} diff --git a/submodules/cas-bacnet-stack b/submodules/cas-bacnet-stack index d8dd2ed..ec0ec97 160000 --- a/submodules/cas-bacnet-stack +++ b/submodules/cas-bacnet-stack @@ -1 +1 @@ -Subproject commit d8dd2ed8ac368d68fbe00c589af02018244336e7 +Subproject commit ec0ec9778ee43f11a1f90350d61ae314fcaed851