Академический Документы
Профессиональный Документы
Культура Документы
/****************************************************************************
Pseudo-code for the DogXBeeReceive service
Receives messages from the controllers XBee and parses out the logic
in an ISR state machine.
InitDogXBeeTransmitService
Takes a priority number, returns true
PostDogXBeeReceiveService
Create PostDogXBeeReceiveService
RunDogXBeeReceiveService
The parameter it takes in will be ThisEvent and the parameter field of
ThisEvent will be the time that the event occurred. Returns ES_NO_Event.
ProcessPacketReceived
13
// If the packet was an encryption key
// Store the encryption key in a module level variable (accessible
// via a getter function)
// Reset the encryption key index to 0
// Post a EV_EncryptReceived event to this service
// Else if we are encrypting, the only packet we should be looking for is
// a control packet
// If packet is a control packet
// Save away important information for use in Control Service
// Post EV_ControlReceived
// Else if the packet was anything other than a control packet (0x04)
// reset the encryption key
// Reset the encryption index to 0
// Post EV_EncryptionReset
// Endif
// Endif
// Else if
// Roll the encryption index back to what it was before (since this was
// not a message from our FARMER
// Endif
// Endif
// Else if the transmit status packet indicates the transmit packet was a NACK or
// a CCA, then resend the previous packet
End of ProcessPacketReceived
ProcessByte
Generalized byte processing procedure, which will add additional functionality
if the input is specified to be frame data
DecryptByte
Decrypts an individual byte using by XORing with the current cipher. Takes in a
decrypted byte and returns an unencrypted byte.
StoreDigitalControlPacket
GetFwdReverseByte
// Return FwdReverseByte
GetFwdReverseByte
// Return LeftRightByte
GetReceivePacketBuffer
Provide a getter function for the ReadBufferIndex
14
ReceiveISR
Continue the transmission process for sending data to an XBee via UART
and keep sending bytes until there are none left to transmit. Takes in
nothing and returns nothing.
End of DogXBeeReceiveService
15