Bluetooth Data Access
A task processor with payload handling is needed to access data over a native serial connection (COM) over bluetooth.
Task Processor
The payload processing must be declared in a processor information within the device info file.
The payload script is typically placed in the folder:
$(ConfigPath)\HumanOS.UHAL.BluetoothDeviceDriver
Example
"TaskProcessors": [
{
"Id": "9bd3ec86-f5fe-4679-8621-751540d602a2",
"Name": "MainTaskProcessor",
"ScriptFile": "TTestPayload.cs",
"Properties": []
}
]
Further information about DataStream Scripting.
Builtin Addresses
Following data node addresses are provided by the plugin. The Stream
namespace is used:
Address | Description | Data Type |
---|---|---|
Stream::Available | Returns the available flag. true if the data stream is open. | System.Boolean |
Stream::SignOfLife | Sign of life. Toggles in 1Hz if the data stream is open. | System.Boolean |
Example
/// <summary>
/// Test payload for script
/// </summary>
public class TTestPayload : TAbstractStreamScriptObject
{
///<see cref="TAbstractStreamScriptObject"/>
public override void handleStream(IKernelAccess Kernel,
ILogger Logger,
TDeviceInfo DeviceInfo,
IDataStream DataStream)
{
byte[] aui8Buffer = new byte[4];
DataStream.read(aui8Buffer, 0, 4);
aui8Buffer[0] = 0x11;
aui8Buffer[1] = 0x21;
aui8Buffer[2] = 0x31;
aui8Buffer[3] = 0x41;
DataStream.write(aui8Buffer, 0, 4);
}
}