NuMaker Pelion Device Management example
Fork of mbed-os-example-pelion by
Diff: main.cpp
- Revision:
- 5:ae686808e015
- Parent:
- 0:f78ec4a22e67
- Child:
- 11:d147172e94b5
--- a/main.cpp Fri Nov 22 11:16:39 2019 +0800 +++ b/main.cpp Fri Nov 22 14:40:12 2019 +0800 @@ -98,6 +98,8 @@ printf("Update progress = %" PRIu8 "%%\n", percent); } +extern "C" MBED_WEAK void dispatch_host_command(int); + int main(void) { int status; @@ -201,6 +203,10 @@ printf("Storage erased, rebooting the device.\n\n"); wait(1); NVIC_SystemReset(); + } else if (dispatch_host_command && in_char != 0x03) { + /* Intercept other host commands */ + dispatch_host_command(in_char); + continue; } else if (in_char > 0 && in_char != 0x03) { // Ctrl+C is 0x03 in Mbed OS and Linux returns negative number button_press(); // Simulate button press continue;