Closed OLLYDOTDEV closed 3 years ago
pseudo-code for the sending function
there are there data packet types that I might send Mode | alert | status
Send role
function Mode(Mode){
check role is a valued role
packet header = mode
data = role
call send packet function.
transmit(header,data)
}
send alert status | only will be called if there is a status change
function sendalert(){
get alert status
packet header = alert
data = status of alert
}
status ||
function getstatus(){
packet header = status
data = power up
}
pseudo-code for the receiving
reader header of packet and trigger a switch state of one of these options
Alert
run selected lockdown scripts
Mode packet
if (packet.type == role ){
switch(){
mode1 (IR) call function to configure ROMS to mode 1 mode2 (PIR) call function to configure ROMS to mode 2 mode3 (ALL) call function to configure ROMS to mode 3 } }
what each mode will do will be done in the next sprint and found in #23
status
- [x] Done
when packet = status {
nothing as it is just to test if there is a connecting between the radios
}
or It might be other in that case it will just output it to the Serial monitor then do nothing with it
https://github.com/OLLYDOTDEV/Project-Birdseye-DTX-2020/commit/08cfda5985f5be98dae3ead022404e1707a74b1c & https://github.com/OLLYDOTDEV/Project-Birdseye-DTX-2020/commit/a8e03e7c9562dfba7869de588345b6778b17c32f contains the implementation of Wireless data processing that is able to account for a range of border cases via using a wide range of different custom functions.
while some of these are the same functions as used in #30 they will have been modified to ensure reliability and validity.
such as RECEIVE()
function updated to support the new data structure of the packets this structure houses the Header
and Data
that is processed using non-trivial string manipulation to allow it to be transmitted. as well as added a case switch.
the switch used in the RECEIVE()
function within the RPI.Cpp
file is using a whitelist system to check for incoming packets that have matching packet header properties of MODE
,STATUS
,ALERT
if it doesn't match any of them then the packet is disregarded.
whereas the RECEIVE()
function for ROMS.ino is only looking for MODE
,STATUS
packet Header as it will be the sending out a packet with an ALERT
header therefor does not need to look for it, this helps with ensuring logical response by simplifying the potential outcomes
another function used/ changed is the TRANSMIT(string header, string data )
this function is able to take two parameters. The header is used to see the header of the packet. this header is used to determine what should be done with the contents inside the packet, eg what mode ROMS should be in or just used to test the connection of the radios. these parameters are phased into char arrays before being formatted into a packet and then transmitted, for more on this process see here
a function added uniquely to RPI.cpp
is void ModeInterface(void)
this function is used to set up the packet that contains what mode ROMS should be in. as for now it is just set to a status value as that in will be added in #23
both will have in time the getstatus()
function and all that does I check if there is a connection between NRF24 radios.
lastly ROMS.ino a function added to it is SecurityMode()
this function allows the data from a MODE packet to be deciphered into instructions. that can be converted into what mode ROMS should be running in.
for next stage of using this data after it has been processed see #23
As a software engineer There needs to be some backend to take the data from #17 #30 and work out what to do with the given data packet. this will lead on to the mode selection found in #23 thus a conditional switching statement will be implemented to complete this story