Sensor Application of BluetoothLowEnergy

28 views
Skip to first unread message

Kartik Patel

unread,
Jun 30, 2016, 1:45:26 AM6/30/16
to ns-3-users
Hi,
I am creating a Sensor Application for BLE node. I have to create a database type model.

For an example:
Attr. Handle    || Attr. Type ||       Attr. Value               ||
----------------------------------------------------------------------
0x0001           ||  0x2800   ||           0x1800                || -- Shows it's a service
0x0002           || 0x2803    || 0x02 | 0x0003 | 0x2A00|| -- 0x0003 is location of actual value
0x0003           || 0x2A00    || "Device 1"                     || -- 0x2A00 shows Type of value i.e. "Device Property"
----------------------------------------------------------------------
The Handle will be used to locate the Attr. Value. On getting request for handle 0x0002, I will check the Attr. Value. Firrst byte will be the permissions. Next 2 bytes will be the handle where the value is stored and next 2 bytes are type of the value. So, 0x0002 is kind of Get Method that we use in OOP. A request can be for 0x0002. Not directly 0x0003.

My problem is: How should I model this in a object of Application? I m thinking to use A queue of Packet: Because it will be easy to frag/combine. But problem will be the search. When I need to search for 0x0002, This Packet structure will not be good. Is there any other easy alternative?

Thank you.
Kartik

Tommaso Pecorella

unread,
Jun 30, 2016, 6:47:32 PM6/30/16
to ns-3-users
Hi,

I have no idea, but I'd suggest to split the database from the actual message parsing. The message (i.e., the request) should have a format. You check the form at for consistency and (only if it is consistent), you take actions. Actions could be as well nested, like in the case you mentioned. 
About how to do it... as I said, no idea. I'd do it with SQLite probably, or with simple maps.

T.

Kartik Patel

unread,
Jul 1, 2016, 12:58:39 AM7/1/16
to ns-3-users
Hi,
String parsing will be bad and/or complicated choice. Anyways, SQLite is probably a good option. But as you can see, the "Attr value" can be anything. So, SQLite won't support it. Moreover it will add an extra and mostly redundant dependency. 

I got a suggestion that I may use a class for a individual Row, the whole DB. But only constraint in that is in the Row, the type of "Attr. Value" can be anything. This modelling looks similar to what we would have got in case of SQLite. I m not sure how to add in C++. Any suggestions? 

In the end if nothing works out, I will try to use String parsing with some manual wrapper functions. Thank you for the suggestion.
Reply all
Reply to author
Forward
0 new messages