| 131 | #define IMIN(a,b) ((a)<(b)?(a):(b)) |
| 132 | |
| 133 | bool BLE_TX::transmit_longrange(ODID_UAS_Data &UAS_data) |
| 134 | { |
| 135 | init(); |
| 136 | // create a packed UAS data message |
| 137 | uint8_t payload[250]; |
| 138 | int length = odid_message_build_pack(&UAS_data, payload, 255); |
| 139 | if (length <= 0) { |
| 140 | return false; |
| 141 | } |
| 142 | |
| 143 | // setup ASTM header |
| 144 | const uint8_t header[] { uint8_t(length+5), 0x16, 0xfa, 0xff, 0x0d, uint8_t(msg_counters[ODID_MSG_COUNTER_PACKED]++) }; |
| 145 | |
| 146 | // combine header with payload |
| 147 | memcpy(longrange_payload, header, sizeof(header)); |
| 148 | memcpy(&longrange_payload[sizeof(header)], payload, length); |
| 149 | int longrange_length = sizeof(header) + length; |
| 150 | |
| 151 | advert.setAdvertisingData(1, longrange_length, longrange_payload); |
| 152 | |
| 153 | // we start advertising when we have the first lot of data to send |
| 154 | if (!started) { |
| 155 | advert.start(); |
| 156 | } |
| 157 | started = true; |
| 158 | |
| 159 | return true; |
| 160 | } |
| 161 | |
| 162 | bool BLE_TX::transmit_legacy(ODID_UAS_Data &UAS_data) |
| 163 | { |
nothing calls this directly
no outgoing calls
no test coverage detected