bristlemouth / bm_protocol

Primary Bristlemouth firmware repository
https://www.bristlemouth.org/
Apache License 2.0
10 stars 7 forks source link

Feature/bcmp linked list #89

Closed victorsowa12 closed 6 months ago

victorsowa12 commented 6 months ago

This PR has a linked list for outgoing "sequenced" messages. These element on the linked list will be removed when we get a BCMP message with the same sequence number, otherwise after 500ms we will time out and remove the element from the linked list.

This PR just has the linked list implemented and basic req/rep for configs and ping (note: PING needs to be removed before the final merge, but it is an easy one to test with in a 2 node system.)

I have created 2 helper functions to categorize the BCMP message types into sequenced requests and sequenced responses. These helper functions are used when sending a BCMP message out and when receiving a BCMP message to determine if we a) care about the sequence number, b) need to stamp the request message with the local sequence number, c) forward the received sequence number in a reply.

Example of a mote requesting sys config status from a bridge:

bm cfg status 4d58ce2f22dfb374 s
BCMP - Sending message with seq_num 4
Successful status request send
BCMP message with seq_num 4 found
BCMP - Received reply to message with seq_num 4
Response msg -- Node Id:4d58ce2f22dfb374,Partition:1, Commit Status:0
Num Keys: 10
bridgePowerControllerEnabled
samplesPerReport
transmitAggregations
sampleIntervalMs
sampleDurationMs
subsampleIntervalMs
subsampleEnabled
currentReadingPeriodMs
alignmentInterval5Min
subsampleDurationMs

Testing TODO: 3+ node system