Monitoring a Device
Devices that are not already supported for monitoring by KioWare can be monitored through an addin. This will allow KioWare to send custom device status information to KioWare Server as if the device was directly supported.
Start by adding the following to the top of your addin class:
using ADSI.KioWare.Client.Platform.Shared.Addins.Devices;
Next, add a local variable to hold your device, and add code to your Load() method to register your new device with KioWare:
MonitoredDeviceInfo mdi1 = null;
public void Load(IKioWareHost host)
{
this.Host = host;
mdi1 = new MonitoredDeviceInfo("MyDevice", "", "00000000", "My Test Device");
host.DeviceManager.MonitoredDeviceManager.SetupDevice(mdi1);
}
You can now set new device information as often as you wish. The status information consists of two properties: a bitfield for status bits, and a string dictionary through which you can send name-value pairs. A function to do so might look like this:
private void SendDeviceStatus()
{
KioDeviceStatus NewStatus = new KioDeviceStatus();
// the status bits and additional information data would normally come from the device,
// but is hardcoded for demo purposes
NewStatus.Status = StatusFlags.LowPaper;
NewStatus.Details.Add("Current Data", "SomeData");
NewStatus.Details.Add("Number of Widgets", "12345");
Host.DeviceManager.MonitoredDeviceManager.SetDeviceStatus(mdi1, NewStatus);
}
The new function, SendDeviceStatus(), could then be called on a regular interval through a timer that is started in Load() and stopped in Unload().