テストモード追加、LED有効化 left -> SerialRX, Data Recieve Complete , Serial Tx , Light Tx

Dependencies:   XBee mbed NetServicesMin

common/data_models.h

Committer:
recotana
Date:
2012-03-22
Revision:
0:42adca80439c
Child:
1:36eb173eb52b

File content as of revision 0:42adca80439c:

#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