RTno is communicating library and framework which allows you to make your embedded device capable of communicating with RT-middleware world. RT-middleware is a platform software to realize Robotic system. In RTM, robots are developed by constructing robotics technologies\' elements (components) named RT-component. Therefore, the RTno helps you to create your own RT-component with your mbed and arduino. To know how to use your RTno device, visit here: http://ysuga.net/robot_e/rtm_e/rtc_e/1065?lang=en To know about RT-middleware and RT-component, visit http://www.openrtm.org

Dependencies:   EthernetInterface mbed-rtos

Committer:
ysuga
Date:
Thu Aug 29 05:29:55 2013 +0000
Revision:
7:6c7af1d50fb3
Parent:
1:f74116b37bc9
update v5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ysuga 0:5f7bc45bc2e8 1 /*******************************************
ysuga 0:5f7bc45bc2e8 2 * Packet.h
ysuga 0:5f7bc45bc2e8 3 * @author Yuki Suga
ysuga 0:5f7bc45bc2e8 4 * @copyright Yuki Suga (ysuga.net) Nov, 10th, 2010.
ysuga 0:5f7bc45bc2e8 5 * @license LGPLv3
ysuga 0:5f7bc45bc2e8 6 *****************************************/
ysuga 0:5f7bc45bc2e8 7
ysuga 0:5f7bc45bc2e8 8 #ifndef PACKET_HEADER_INCLUDED
ysuga 0:5f7bc45bc2e8 9 #define PACKET_HEADER_INCLUDED
ysuga 0:5f7bc45bc2e8 10
ysuga 0:5f7bc45bc2e8 11 // Return Values
ysuga 0:5f7bc45bc2e8 12 #define TIMEOUT 1
ysuga 0:5f7bc45bc2e8 13 #define DATA_TIMEOUT 2
ysuga 0:5f7bc45bc2e8 14 #define CHECKSUM_ERROR 3
ysuga 0:5f7bc45bc2e8 15
ysuga 0:5f7bc45bc2e8 16 #define INVALID_PACKET_INTERFACE 65
ysuga 0:5f7bc45bc2e8 17 #define INVALID_PACKET_DATASIZE 66
ysuga 0:5f7bc45bc2e8 18
ysuga 0:5f7bc45bc2e8 19 // Packet Settings
ysuga 1:f74116b37bc9 20 #define STARTING_HEADER_SIZE 2
ysuga 0:5f7bc45bc2e8 21 #define PACKET_HEADER_SIZE 2
ysuga 0:5f7bc45bc2e8 22 #define INTERFACE 0
ysuga 0:5f7bc45bc2e8 23 #define DATA_LENGTH 1
ysuga 1:f74116b37bc9 24 //#define DATA_START_ADDR 2+4
ysuga 1:f74116b37bc9 25
ysuga 1:f74116b37bc9 26 #define PACKET_STARTING_CHARACTOR_0 0x0a
ysuga 1:f74116b37bc9 27 #define PACKET_STARTING_CHARACTOR_1 0x0a
ysuga 0:5f7bc45bc2e8 28
ysuga 0:5f7bc45bc2e8 29 enum {
ysuga 0:5f7bc45bc2e8 30 RTC_STATE_CREATED='C',
ysuga 0:5f7bc45bc2e8 31 RTC_STATE_INACTIVE='I',
ysuga 0:5f7bc45bc2e8 32 RTC_STATE_ACTIVE='A',
ysuga 0:5f7bc45bc2e8 33 RTC_STATE_ERROR='E',
ysuga 0:5f7bc45bc2e8 34 RTC_STATE_NONE='N',
ysuga 0:5f7bc45bc2e8 35 };
ysuga 0:5f7bc45bc2e8 36
ysuga 0:5f7bc45bc2e8 37
ysuga 0:5f7bc45bc2e8 38 // Protocol
ysuga 0:5f7bc45bc2e8 39 // Interface
ysuga 0:5f7bc45bc2e8 40 #define INITIALIZE 'I'
ysuga 0:5f7bc45bc2e8 41 #define ACTIVATE 'A'
ysuga 0:5f7bc45bc2e8 42 #define DEACTIVATE 'D'
ysuga 0:5f7bc45bc2e8 43 #define EXECUTE 'E'
ysuga 0:5f7bc45bc2e8 44 #define ONERROR 'C'
ysuga 0:5f7bc45bc2e8 45 #define RESET 'R'
ysuga 0:5f7bc45bc2e8 46 #define GET_STATUS 'X'
ysuga 0:5f7bc45bc2e8 47 #define GET_DATA 'G'
ysuga 0:5f7bc45bc2e8 48 #define SEND_DATA 'S'
ysuga 0:5f7bc45bc2e8 49 #define GET_PROFILE 'Z'
ysuga 0:5f7bc45bc2e8 50 #define GET_CONTEXT 'B'
ysuga 0:5f7bc45bc2e8 51 #define PACKET_ERROR 'F'
ysuga 0:5f7bc45bc2e8 52 #define RECEIVE_DATA 'V'
ysuga 0:5f7bc45bc2e8 53
ysuga 0:5f7bc45bc2e8 54 #define ADD_INPORT 'P'
ysuga 0:5f7bc45bc2e8 55 #define ADD_OUTPORT 'Q'
ysuga 0:5f7bc45bc2e8 56
ysuga 0:5f7bc45bc2e8 57 #define INPORT_ISNEW 'N'
ysuga 0:5f7bc45bc2e8 58 #define INPORT_READ 'J'
ysuga 0:5f7bc45bc2e8 59
ysuga 0:5f7bc45bc2e8 60 #define RTNO_OK '@'
ysuga 0:5f7bc45bc2e8 61 #define RTNO_ERROR 'x'
ysuga 0:5f7bc45bc2e8 62 #define RTNO_NONE '!'
ysuga 0:5f7bc45bc2e8 63
ysuga 0:5f7bc45bc2e8 64 #define OUTPORT_WRITE 'W'
ysuga 0:5f7bc45bc2e8 65
ysuga 0:5f7bc45bc2e8 66 // Communication Settings
ysuga 0:5f7bc45bc2e8 67 #define PACKET_WAITING_TIME 100 // ms
ysuga 0:5f7bc45bc2e8 68 #define PACKET_WAITING_DELAY 100 //us
ysuga 0:5f7bc45bc2e8 69 #define PACKET_WAITING_COUNT (PACKET_WAITING_TIME*1000/PACKET_WAITING_DELAY)
ysuga 0:5f7bc45bc2e8 70
ysuga 0:5f7bc45bc2e8 71
ysuga 0:5f7bc45bc2e8 72 #define TYPECODE_TIMED_BOOLEAN 'b'
ysuga 0:5f7bc45bc2e8 73 #define TYPECODE_TIMED_CHAR 'c'
ysuga 0:5f7bc45bc2e8 74 #define TYPECODE_TIMED_OCTET 'o'
ysuga 0:5f7bc45bc2e8 75
ysuga 0:5f7bc45bc2e8 76
ysuga 0:5f7bc45bc2e8 77 #define TYPECODE_TIMED_LONG 'l'
ysuga 0:5f7bc45bc2e8 78 #define TYPECODE_TIMED_FLOAT 'f'
ysuga 0:5f7bc45bc2e8 79 #define TYPECODE_TIMED_DOUBLE 'd'
ysuga 0:5f7bc45bc2e8 80
ysuga 0:5f7bc45bc2e8 81 #define TYPECODE_TIMED_BOOLEAN_SEQ 'B'
ysuga 0:5f7bc45bc2e8 82 #define TYPECODE_TIMED_CHAR_SEQ 'C'
ysuga 0:5f7bc45bc2e8 83 #define TYPECODE_TIMED_OCTET_SEQ 'O'
ysuga 0:5f7bc45bc2e8 84
ysuga 0:5f7bc45bc2e8 85
ysuga 0:5f7bc45bc2e8 86 #define TYPECODE_TIMED_LONG_SEQ 'L'
ysuga 0:5f7bc45bc2e8 87 #define TYPECODE_TIMED_FLOAT_SEQ 'F'
ysuga 0:5f7bc45bc2e8 88 #define TYPECODE_TIMED_DOUBLE_SEQ 'D'
ysuga 0:5f7bc45bc2e8 89
ysuga 0:5f7bc45bc2e8 90 #endif