Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of football_project by
Diff: PhoneAppIO.cpp
- Revision:
- 19:afcbb425b3cf
- Parent:
- 11:d3aa5fca2330
- Child:
- 75:1b357bee1839
--- a/PhoneAppIO.cpp Sun Nov 29 13:52:53 2015 +0000
+++ b/PhoneAppIO.cpp Tue Dec 01 16:03:15 2015 +0000
@@ -61,6 +61,26 @@
return bytesRead;
}
+uint16_t PhoneAppIO::injectHandleRead( char *buf, int len ) // Inject data from elsewhere simulating BLE-in.
+{ // also writes to txPayload
+ int bytesRead = 0;
+
+ if( (NULL != buf) && (0 < len) )
+ {
+ bytesRead = MIN( len, TXRX_BUF_LEN );
+
+ // Copy data to accessible location for others and handleRead().
+ memset( txPayload, 0, TXRX_BUF_LEN );
+ memcpy( txPayload, buf, bytesRead );
+
+ // Buffer the data.
+ data = (char *)txPayload;
+ handleRead();
+ }
+
+ return bytesRead;
+}
+
// Maybe write to RX characteristic (From cone to phone.)
uint16_t PhoneAppIO::maybeHandleWrite() // Called by toPhoneChk() from main loop.
{
