Configuration

You will find information about parameter configuration by Bluetooth here

There is a mobile application presently only available for Android being developed, which supports updating of parameters using the on board Bluetooth 5 interface.

When you power on the device, it presents itself with the name P2PSRV1

The device runs a Custom P2P server Bluetooth profile code which exposes a few characteristics to be written to or read from to interact with the device.

Here are the Bluetooth interface details you need to be able to read and write from the device,

Service UUID : 0000fe40-cc7a-482a-984a-7f2ed5b3e58f

TX Characteristic : 0000fe41-8e22-4541-9d4c-21edae82ed19

Rx Characteristic : 0000fe42-8e22-4541-9d4c-21edae82ed19

Transmission and reception is from phones perspective

List of parameters supported :

Writing new parameter values to the device :

When you want to update a parameters value, you need to write to the TX characteristic given above.

The format to write data is as follows,

InputData = '$VALETRON:' + InputIndex + '-' + $('#i'+InputID).val() + '#';

If you look at the above line, its a JavaScript line which forms the command to be sent to the device.

ex.,

if you want to update the Contact Number parameter to 1234567890, the command will become,

$VALETRON:4-1234567890#

Here the content between - (hyphen) and # (hash) characters which is 1234567890 will be written to the Contact Number parameter whose index is 4.

“$VALETRON:” is the header and the “#” is like the footer which help the device to parse the command easily.

Once you have formed this command, you have to send the command, in a certain byte format to the device, Look at this code JavaScript code below,

for(var i=0;i<InputData.length;i++)
{
    data1[0] = 0x01; // Packet Identifer - Parameter Ppdate Packet
    data1[1] = InputData.charCodeAt(i);
            
    ble.writeWithoutResponse(
        deviceId,
        bluefruit.serviceUUID,
        bluefruit.txCharacteristic,
        data1.buffer, success, failure
    );
}

Here we are sending 0x01 as the first byte and our command byte as the second byte. Here 0x01 is a packet identifier that indicates to the device that the byte that follows is a parameter update data.

ex.,

Our data will be sent to device like this,

0x01, $

0x01, V

0x01, A etc

Reading values from the device :

When you want to read anything from the device, you subscribe to the RX characteristic given above.

Whenever a data is available, the phone is notified by Bluetooth.

When you want to manually read the parameters, Everything explained above holds good and you just need to replace the first byte, which is the packet identifier with data1[0] = 0x02; to indicate that its a parameter read command in below code snippet.

for(var i=0;i<InputData.length;i++)
{
    data1[0] = 0x02; // Packet Identifer - Parameter Read Packet
    data1[1] = InputData.charCodeAt(i);
            
    ble.writeWithoutResponse(
        deviceId,
        bluefruit.serviceUUID,
        bluefruit.txCharacteristic,
        data1.buffer, success, failure
    );
}

Here we are sending 0x02 as the first byte and our command byte as the second byte. Here 0x02 is a packet identifier that indicates to the device that the byte that follows is a parameter read data.

ex.,

Our data will be sent to device like this,

0x02, $

0x02, V

0x02, A etc

For example,

You can read the contact number parameter with $VALETRON:4-000# command.

Last updated