nakagawa kit emurator (add CR) BaudRate 115200,p20

Dependencies:   mbed NetServicesMin

Revision:
0:e5342390978b
Child:
3:51e64f5e42b8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/data_models.h	Thu Mar 22 14:35:48 2012 +0000
@@ -0,0 +1,71 @@
+#ifndef _DATA_MODELS_
+#define _DATA_MODELS_
+
+#include "types.h"
+
+//frame type 
+typedef enum{
+    Ftype_NoID  =0,
+    Ftype_Type_A=1,
+    Ftype_Type_B=4
+} Ftype;
+
+typedef enum{
+    SERVER,
+    LED_SENDER,
+    LED_RECIEVER
+} Device;
+
+typedef enum{
+    PING,
+    ACK,
+    RECIEVE,
+    SEND_SINGLE,
+    SEND_CONTINUEOUS,
+    SEND_CONT_STOP,
+    SET_TX_GAIN
+} Command;
+
+//
+//for TCP/IP data structure
+//
+
+//message data  48byte(size fix) 
+typedef struct{
+    uint16_t totalSize;   //2(total size) + 2(frame number) + 1(device) + 1(command) + 42(data:max 42) <--- max 48
+    uint16_t frameNumber;
+    Device   device;
+    Command  command;
+    uint8_t  data[42]; //0 fill,size fix
+} Message;
+
+//payload id  16byte 
+typedef struct{
+    uint16_t head;              //reserve 0x0000
+    uint8_t  personalId[14]; 
+} ID;
+
+typedef struct{
+    ID      id;         // 16 byte
+    Message message;    // 48 byte
+} Frame;
+
+//66byte Payload
+typedef struct{
+    uint16_t    size;     // 2(size) + 1(dummy) + 1(Ftype) + 64(frame) = 68 byte
+    uint8_t     dummy;    //adjust Alignment
+    Ftype       ftype;  
+    Frame       frame;    //64byte
+} Payload;
+
+
+void initPayload(Payload *_payload);
+
+void payloadToNetwork(Payload *_payload);
+void networkToPayload(Payload *_payload);
+
+void initTestPayloadData(Payload *_payload);
+
+void dumpPayload(Payload *_payload);
+
+#endif
\ No newline at end of file