void manipulateOutgoingPayloadData() { const static std::array shift = EXPUNGED uint8_t ns = random(16); uint8_t reserved[2] = {0x01, 0x02}; std::array payloadBytes = generatePayloadBytes(reserved); //The above will return something like 01 02 45 3e 0b 73 70 4a 66 72 44 45 56 4b 68 31 /** which would equate to: reserved[0] = 01 reserved[1] = 02 temp = 0x45 or 69 humidity = 0x3e or 62 wind speed = 0x0b or 11 air quality = 0x73 or 115 flag = 0x70 4a 66 72 44 45 56 4b 68 31 or pJfrDEVKh1 */ txpacket[0] = 3; txpacket[1] = ns; //txpacket is a global variable e.g. uint8_t txpacket[BUFFER_SIZE]; and will be what is ultimately sent over the air //The first byte contains the team number. The first byte must not be changed in any way so that the middleware knows which team to route the //packet to for (int i = 2; i < BUFFER_SIZE; i++) { txpacket[i] = payloadBytes[i] ^ shift[ns]; ++ns; ns %= 16; } //So basically, if you want to for example apply a caesar cipher to the payload, you would loop through //each byte in payloadBytes, change the byte (apply the cipher), and then assign that byte to the correct //position of txpacket. Remember that you will then need to decrypt/decode after your weather //station receives it, so you could do this in mqtt_subscriber.py on weather station //or in the POST handler in weather-backend on WWW or anywhere else, it's up to you, as long as the //plaintext weather data gets saved in the WWW db and displayed on the website }