Closed pspeybro closed 2 years ago
Most of the devices I worked with had two general methods:
The first can run entirely inside the DemoApplication class. The second needs your callback code to call DemoApplication when updated.
Ok, thank you, I will look into it.
I was looking at the code of the example server to provide some (hardware) sensordata, but it would be nice to have a little more documentation on how to extend the example.
In the sample, the main program is updating data in the OPC UA server by calling the app.PlayRow(); from the DemoApplication. Is this the recommended way to provide external data to the OPC server? In app.PlayRow(), the "new data" is generated inside this method, but normally the data would come from somewhere else (sensors, measuring devices, calculations, ...).
Suppose I have some methods to fetch data from a few sensors/devices that are attached to my raspberry pi (System.Device.Gpio library). Where should I connect these methods to the server?
Should I just have a timer like in the sample that fetches the sensor data and then sends it to the DemoApplication with var sensordata = ReadSensor(sensorId); app.UpdateSensor(sensordata.SensorId, sensordata.Value, sensordata.Timestamp); where UpdateSensor would call MonitorNotifyDataChange(node.Id, new DataValue(...)) Or is it better to include all this inside the DemoApplication class and have this class manage the timers and read the sensors on its own?
What is the recommended way to handle Data writes to the server (for example to set a relay). Provide the DemoApplication with some callbacks (change relay pin for example) that can be called depending on the nodeId/AttributeId in HandleDataWrite?
Are there any more advanced examples out there?