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
Packet.h@0:5f7bc45bc2e8, 2013-06-24 (annotated)
- Committer:
- ysuga
- Date:
- Mon Jun 24 06:42:11 2013 +0000
- Revision:
- 0:5f7bc45bc2e8
- Child:
- 1:f74116b37bc9
[mbed] converted /RTnoV3/RTnoV3
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:5f7bc45bc2e8 | 20 | #define PACKET_HEADER_SIZE 2 |
ysuga | 0:5f7bc45bc2e8 | 21 | #define INTERFACE 0 |
ysuga | 0:5f7bc45bc2e8 | 22 | #define DATA_LENGTH 1 |
ysuga | 0:5f7bc45bc2e8 | 23 | #define DATA_START_ADDR 2 |
ysuga | 0:5f7bc45bc2e8 | 24 | |
ysuga | 0:5f7bc45bc2e8 | 25 | enum { |
ysuga | 0:5f7bc45bc2e8 | 26 | RTC_STATE_CREATED='C', |
ysuga | 0:5f7bc45bc2e8 | 27 | RTC_STATE_INACTIVE='I', |
ysuga | 0:5f7bc45bc2e8 | 28 | RTC_STATE_ACTIVE='A', |
ysuga | 0:5f7bc45bc2e8 | 29 | RTC_STATE_ERROR='E', |
ysuga | 0:5f7bc45bc2e8 | 30 | RTC_STATE_NONE='N', |
ysuga | 0:5f7bc45bc2e8 | 31 | }; |
ysuga | 0:5f7bc45bc2e8 | 32 | |
ysuga | 0:5f7bc45bc2e8 | 33 | |
ysuga | 0:5f7bc45bc2e8 | 34 | // Protocol |
ysuga | 0:5f7bc45bc2e8 | 35 | // Interface |
ysuga | 0:5f7bc45bc2e8 | 36 | #define INITIALIZE 'I' |
ysuga | 0:5f7bc45bc2e8 | 37 | #define ACTIVATE 'A' |
ysuga | 0:5f7bc45bc2e8 | 38 | #define DEACTIVATE 'D' |
ysuga | 0:5f7bc45bc2e8 | 39 | #define EXECUTE 'E' |
ysuga | 0:5f7bc45bc2e8 | 40 | #define ONERROR 'C' |
ysuga | 0:5f7bc45bc2e8 | 41 | #define RESET 'R' |
ysuga | 0:5f7bc45bc2e8 | 42 | #define GET_STATUS 'X' |
ysuga | 0:5f7bc45bc2e8 | 43 | #define GET_DATA 'G' |
ysuga | 0:5f7bc45bc2e8 | 44 | #define SEND_DATA 'S' |
ysuga | 0:5f7bc45bc2e8 | 45 | #define GET_PROFILE 'Z' |
ysuga | 0:5f7bc45bc2e8 | 46 | #define GET_CONTEXT 'B' |
ysuga | 0:5f7bc45bc2e8 | 47 | #define PACKET_ERROR 'F' |
ysuga | 0:5f7bc45bc2e8 | 48 | #define RECEIVE_DATA 'V' |
ysuga | 0:5f7bc45bc2e8 | 49 | |
ysuga | 0:5f7bc45bc2e8 | 50 | #define ADD_INPORT 'P' |
ysuga | 0:5f7bc45bc2e8 | 51 | #define ADD_OUTPORT 'Q' |
ysuga | 0:5f7bc45bc2e8 | 52 | |
ysuga | 0:5f7bc45bc2e8 | 53 | #define INPORT_ISNEW 'N' |
ysuga | 0:5f7bc45bc2e8 | 54 | #define INPORT_READ 'J' |
ysuga | 0:5f7bc45bc2e8 | 55 | |
ysuga | 0:5f7bc45bc2e8 | 56 | #define RTNO_OK '@' |
ysuga | 0:5f7bc45bc2e8 | 57 | #define RTNO_ERROR 'x' |
ysuga | 0:5f7bc45bc2e8 | 58 | #define RTNO_NONE '!' |
ysuga | 0:5f7bc45bc2e8 | 59 | |
ysuga | 0:5f7bc45bc2e8 | 60 | #define OUTPORT_WRITE 'W' |
ysuga | 0:5f7bc45bc2e8 | 61 | |
ysuga | 0:5f7bc45bc2e8 | 62 | // Communication Settings |
ysuga | 0:5f7bc45bc2e8 | 63 | #define PACKET_WAITING_TIME 100 // ms |
ysuga | 0:5f7bc45bc2e8 | 64 | #define PACKET_WAITING_DELAY 100 //us |
ysuga | 0:5f7bc45bc2e8 | 65 | #define PACKET_WAITING_COUNT (PACKET_WAITING_TIME*1000/PACKET_WAITING_DELAY) |
ysuga | 0:5f7bc45bc2e8 | 66 | |
ysuga | 0:5f7bc45bc2e8 | 67 | |
ysuga | 0:5f7bc45bc2e8 | 68 | #define TYPECODE_TIMED_BOOLEAN 'b' |
ysuga | 0:5f7bc45bc2e8 | 69 | #define TYPECODE_TIMED_CHAR 'c' |
ysuga | 0:5f7bc45bc2e8 | 70 | #define TYPECODE_TIMED_OCTET 'o' |
ysuga | 0:5f7bc45bc2e8 | 71 | |
ysuga | 0:5f7bc45bc2e8 | 72 | |
ysuga | 0:5f7bc45bc2e8 | 73 | #define TYPECODE_TIMED_LONG 'l' |
ysuga | 0:5f7bc45bc2e8 | 74 | #define TYPECODE_TIMED_FLOAT 'f' |
ysuga | 0:5f7bc45bc2e8 | 75 | #define TYPECODE_TIMED_DOUBLE 'd' |
ysuga | 0:5f7bc45bc2e8 | 76 | |
ysuga | 0:5f7bc45bc2e8 | 77 | #define TYPECODE_TIMED_BOOLEAN_SEQ 'B' |
ysuga | 0:5f7bc45bc2e8 | 78 | #define TYPECODE_TIMED_CHAR_SEQ 'C' |
ysuga | 0:5f7bc45bc2e8 | 79 | #define TYPECODE_TIMED_OCTET_SEQ 'O' |
ysuga | 0:5f7bc45bc2e8 | 80 | |
ysuga | 0:5f7bc45bc2e8 | 81 | |
ysuga | 0:5f7bc45bc2e8 | 82 | #define TYPECODE_TIMED_LONG_SEQ 'L' |
ysuga | 0:5f7bc45bc2e8 | 83 | #define TYPECODE_TIMED_FLOAT_SEQ 'F' |
ysuga | 0:5f7bc45bc2e8 | 84 | #define TYPECODE_TIMED_DOUBLE_SEQ 'D' |
ysuga | 0:5f7bc45bc2e8 | 85 | |
ysuga | 0:5f7bc45bc2e8 | 86 | #endif |