The BeTelGeuse Protocol

BeTelGeuse data transmission protocol (2.10.2008)

The BeTelGeuse data transmission protocol (BDT) is designed for BeTelGeuse software. Its goal is to allow simple and lightweight communication of sensor data to, for example, a server. BDT is designed so that communication overhead is minimal.

Conventions of this document

Requirements

The communication media must support raw byte values. For example HTTP RPC requests are out of question because of the limitations of XML. BDT needs to be lightweight because BeTelGeuse was designed to be run on mobile devices.

BDT protocol

Direction <<--- means a transmission from BeTelGeuse to some other device. Direction --->> means messages which are sent to BeTelGeuse. The BDT messages are:

CommandDirectionDescription
c, C - 0x63 or 0x43   
<<---
 Connection initialization message.       
r, R - 0x72 or 0x52   
--->>
 Connection initialization response.       
s, S - 0x73 or 0x53   
<<---
Sensor configuration message.       
i, I - 0x69 or 0x49  
--->>
Sensor identification message.       
d, D - 0x64 or 0x44   
<<---
Data message.       
q, Q - 0x71 or 0x51   
<<---
Connection termination message       
t, T - 0x74 or 0x54   
--->>
Connection termination confirmation.       

Connection initialization message -- C

1
3
2
1
1
12
1
n
Cmd
Length
SessionID
Sender type
Compression
Bta
Friendly name length
Friendly name
1
n
1
n
Username length
Username
Password length
Password

BeTelGeuse initializes the connection with the initialization message. The response to this message contains an identification number.

Connection initialization response -- R

1
3
2
1
1
n
1
m
Cmd
Length
Session ID
Login status code
DB SessionID length
DB SessionID
Time length
Server time

After the connection initialization response the connection is considered to be open. Sensor configuration and data messages are disregarded before connection initialization and its response have been sent. Session ID is used to identify the sender. If the session ID is the same Betelgeuse requested to keep, sending of sensor configuration messages is not necessary. However if a new session ID is assigned to Betelgeuse, sensor configuration messages need to be sent before sending any data.

Sensor configuration message -- S

Sensor configuration message is used to transmit information about sensors and the format of the data that will be sent.

     1 
      3     
   2   
     2      
       n       
Cmd
  Length 
 Session ID 
 Number of sensors  
Sensor      ...      Sensor   

Sensor configuration message has a header which consists of:

The payload consists of one or more sensor configurations. The format for a sensor configuration is:

2
12
2
1
m
2
n
Sensor ID
BT address
Sensor type
LON
Friendly name
Number of parameters
Parameter ... Parameter

Sensor identification message -- I

The server replies to sensor configuration with sensor identification message.

 1 
    3     
     2     
       2        
 Cmd  
 Length  
 SessionID  
 Number of sensors  

Sensor identification message has a header which consists of:

Data message -- D

Data message is used to transmit sensor data from BeTelGeuse.

1
3
2
2
n
Cmd
Length
Session ID
Number of blocks 
 Data  ...  Data 

Data message header consists of:

The payload consists of one or more data blocks. The format for a data block is:

2
1
1
2
x
1
2
x
...
1
2
x
Sensor ID
NOP
Param ID
Length
Value
Param ID
Length
Value
...
Param ID
Length
Value

The session ID field in the header is used to identify the sender. Sensor IDs are used to identify the sensors and parameter ID fields to identify the parameters. Betelgeuse can send all the parameters from all the sensors connected to it with just one Data message, or it can choose to send only small subset of one sensor's parameters.

Connection termination message -- Q

1
3
2
Cmd
Length
Session ID

BeTelGeuse or the receiver sends a connection termination message when they want to close the connection.

Connection termination confirmation -- T

1
3
2
Cmd
Length
Session ID

Connection termination confirmation is sent when the sender is ready to close the connection after receiving the connection termination message.