This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What is the init Sequence Number for second, third .... device?(NRF Mesh Android)

In NRF Mesh Android, when we set the init value for sequence number (SequenceNumber.java), it will check the sequence value stored in SharedPreferences and return 0 if SharedPreferences is null, otherwise, it will return the value stored in the SharedPreferences. So, my question is that after we provision and control the first device, we continue provision and control the second device, then the sequence number in the second device will start from 0 or from the latest sequence number of the first device? In case it works as the second case(means that the sequence number in the second device starts from the latest sequence number of the first device), is it possible that sequence number will be overflow? And when the sequence number is overflow, e.g the sequence number in the second device is overflow, can we still be able to control the first device( after overflow, the sequence number in the second device will reset to zero but in the first device, the sequence number has a different value)? 

  • @HaiDang To answer your question, yes it starts at 0 and the sequence number is bound to the address and is not dependent of the node you send to. For example we send a message to node1 with sequece number 1 and when sending a message to node2 it should have the sequence number 2 because its bound to the address of the node that is sending the message. According to the bluetooth mesh specification section 3.8.3 sequence number its a 24-bit value and once it reaches the maximum value of 0xFFFFFF it should update the IV Index using the IV Update procedure. This is not something that is implemented in the library so far. So basically when the Sequence number reaches the maximum value and if the iv index is not updated you will not be able to control the devices in the network anymore.

    Also I recommend using the latest version from the dev branch on github repo of the Android Mesh Library as there have been important improvements/changes made that deprecates the usage of SharedPreferences etc. 

    Hope this answers your question.

Related