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.
Diff: comms.h
- Revision:
- 0:03e8a03052c9
diff -r 000000000000 -r 03e8a03052c9 comms.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/comms.h Fri Aug 27 15:20:30 2010 +0000
@@ -0,0 +1,53 @@
+/**
+ * @file comms.h
+ * Header file for comms.cpp
+ * A simplistic communication profile for streaming data sampled
+ * from sensors over UART->radio->UART->dislpay
+ *
+ * @brief Header file for comms.cpp
+ *
+ * @author James A C Patterson
+ */
+#ifndef COMMS_H
+#define COMMS_H
+
+#define MAX_PACKET_SIZE 64
+
+#define PORT_BASE (1<<13)
+#define PROTOCOL 17
+
+typedef struct header {
+ uint16_t src_port;
+ uint16_t dst_port;
+ uint16_t length;
+ uint16_t checksum;
+} header_t;
+
+
+typedef uint8_t packet_t[MAX_PACKET_SIZE];
+
+typedef struct pseudo_header {
+ uint32_t src_addr;
+ uint32_t dst_addr;
+ uint16_t protocol;
+ uint16_t length;
+ uint16_t checksum;
+} pseudo_header_t;
+
+/**
+ * A class to implement a basic transport layer that is based very
+ * loosely on UDP/UDP-lite
+ */
+class Transport {
+public:
+ Transport (uint32_t, uint32_t, uint32_t);
+ void get_packet (uint8_t**,uint16_t*);
+ void load_data (uint16_t*,uint16_t);
+ void set_dst_port (uint16_t);
+private:
+ pseudo_header_t pseudo_header_;
+ header_t header_;
+ packet_t packet_;
+};
+
+#endif
\ No newline at end of file