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.
Dependencies: ros_lib_kinetic
Diff: HLComms.cpp
- Revision:
- 9:cd3607ba5643
- Parent:
- 7:5b6a2cefbf3b
- Child:
- 11:7029367a1840
diff -r d6657767a182 -r cd3607ba5643 HLComms.cpp
--- a/HLComms.cpp Tue Aug 07 09:18:15 2018 +0000
+++ b/HLComms.cpp Tue Aug 07 14:15:37 2018 +0000
@@ -69,6 +69,7 @@
void HLComms::close_server(void) {
+ printf("Closing server...\n\r");
interfaces.clt_sock.close();
interfaces.srv.close();
interfaces.eth.disconnect();
@@ -76,7 +77,15 @@
}
-msg_format HLComms::consume_message( unsigned char * msg ) { //HLComms::msg_format
+int HLComms::receive_message(void) {
+ memset(recv_buffer, 0, sizeof(recv_buffer));
+ int error_code = interfaces.clt_sock.recv(recv_buffer, 1024); // Blocks until data is received
+ return error_code;
+}
+
+
+msg_format HLComms::process_message(void) { //HLComms::msg_format
+ unsigned char * msg = recv_buffer;
// Break message string into chunks at each comma
vector<string> tokens;
char * delim = ",";
@@ -115,4 +124,15 @@
//throw std::invalid_argument( "received negative value" );
//return 0;
return input;
-} // End of consume_message()
\ No newline at end of file
+} // End of consume_message()
+
+void HLComms::make_message(double *dblTime) {
+ memset(send_buffer, 0, sizeof(send_buffer));
+ _snprintf(send_buffer,64,"%f",*dblTime);
+}
+
+int HLComms::send_message(void) {
+ char * msg = send_buffer;
+ int error_code = interfaces.clt_sock.send(msg, strlen(msg));
+ return error_code;
+}
\ No newline at end of file