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
RTnoProfile.cpp@0:5f7bc45bc2e8, 2013-06-24 (annotated)
- Committer:
- ysuga
- Date:
- Mon Jun 24 06:42:11 2013 +0000
- Revision:
- 0:5f7bc45bc2e8
[mbed] converted /RTnoV3/RTnoV3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ysuga | 0:5f7bc45bc2e8 | 1 | #define RTNO_SUBMODULE_DEFINE |
ysuga | 0:5f7bc45bc2e8 | 2 | |
ysuga | 0:5f7bc45bc2e8 | 3 | #include "mbed.h" |
ysuga | 0:5f7bc45bc2e8 | 4 | |
ysuga | 0:5f7bc45bc2e8 | 5 | #include "RTnoProfile.h" |
ysuga | 0:5f7bc45bc2e8 | 6 | |
ysuga | 0:5f7bc45bc2e8 | 7 | static PortBase *m_ppInPort[MAX_PORT]; |
ysuga | 0:5f7bc45bc2e8 | 8 | static PortBase *m_ppOutPort[MAX_PORT]; |
ysuga | 0:5f7bc45bc2e8 | 9 | |
ysuga | 0:5f7bc45bc2e8 | 10 | void RTnoProfile_init() |
ysuga | 0:5f7bc45bc2e8 | 11 | { |
ysuga | 0:5f7bc45bc2e8 | 12 | } |
ysuga | 0:5f7bc45bc2e8 | 13 | |
ysuga | 0:5f7bc45bc2e8 | 14 | int RTnoProfile_addInPort(PortBase* port) |
ysuga | 0:5f7bc45bc2e8 | 15 | { |
ysuga | 0:5f7bc45bc2e8 | 16 | int index = RTnoProfile_getNumInPort(); |
ysuga | 0:5f7bc45bc2e8 | 17 | if(index == MAX_PORT) return -1; |
ysuga | 0:5f7bc45bc2e8 | 18 | m_ppInPort[index] = port; |
ysuga | 0:5f7bc45bc2e8 | 19 | return index; |
ysuga | 0:5f7bc45bc2e8 | 20 | } |
ysuga | 0:5f7bc45bc2e8 | 21 | |
ysuga | 0:5f7bc45bc2e8 | 22 | |
ysuga | 0:5f7bc45bc2e8 | 23 | int RTnoProfile_addOutPort(PortBase* port) |
ysuga | 0:5f7bc45bc2e8 | 24 | { |
ysuga | 0:5f7bc45bc2e8 | 25 | int index = RTnoProfile_getNumOutPort(); |
ysuga | 0:5f7bc45bc2e8 | 26 | if(index == MAX_PORT) return -1; |
ysuga | 0:5f7bc45bc2e8 | 27 | m_ppOutPort[index] = port; |
ysuga | 0:5f7bc45bc2e8 | 28 | return index; |
ysuga | 0:5f7bc45bc2e8 | 29 | } |
ysuga | 0:5f7bc45bc2e8 | 30 | |
ysuga | 0:5f7bc45bc2e8 | 31 | int RTnoProfile_getNumInPort() { |
ysuga | 0:5f7bc45bc2e8 | 32 | for(int i = 0;i < MAX_PORT;i++) { |
ysuga | 0:5f7bc45bc2e8 | 33 | if(m_ppInPort[i] == NULL) { |
ysuga | 0:5f7bc45bc2e8 | 34 | return i; |
ysuga | 0:5f7bc45bc2e8 | 35 | } |
ysuga | 0:5f7bc45bc2e8 | 36 | } |
ysuga | 0:5f7bc45bc2e8 | 37 | return MAX_PORT; |
ysuga | 0:5f7bc45bc2e8 | 38 | } |
ysuga | 0:5f7bc45bc2e8 | 39 | |
ysuga | 0:5f7bc45bc2e8 | 40 | |
ysuga | 0:5f7bc45bc2e8 | 41 | int RTnoProfile_getNumOutPort() { |
ysuga | 0:5f7bc45bc2e8 | 42 | for(int i = 0;i < MAX_PORT;i++) { |
ysuga | 0:5f7bc45bc2e8 | 43 | if(m_ppOutPort[i] == NULL) { |
ysuga | 0:5f7bc45bc2e8 | 44 | return i; |
ysuga | 0:5f7bc45bc2e8 | 45 | } |
ysuga | 0:5f7bc45bc2e8 | 46 | } |
ysuga | 0:5f7bc45bc2e8 | 47 | return MAX_PORT; |
ysuga | 0:5f7bc45bc2e8 | 48 | |
ysuga | 0:5f7bc45bc2e8 | 49 | } |
ysuga | 0:5f7bc45bc2e8 | 50 | |
ysuga | 0:5f7bc45bc2e8 | 51 | PortBase* RTnoProfile_getInPort(const char* name, uint8_t nameLen) |
ysuga | 0:5f7bc45bc2e8 | 52 | { |
ysuga | 0:5f7bc45bc2e8 | 53 | for(uint8_t i = 0;i < MAX_PORT;i++) { |
ysuga | 0:5f7bc45bc2e8 | 54 | if(m_ppInPort[i] == NULL) return NULL; |
ysuga | 0:5f7bc45bc2e8 | 55 | if(strncmp(name, m_ppInPort[i]->pName, nameLen) == 0) { |
ysuga | 0:5f7bc45bc2e8 | 56 | return m_ppInPort[i]; |
ysuga | 0:5f7bc45bc2e8 | 57 | } |
ysuga | 0:5f7bc45bc2e8 | 58 | } |
ysuga | 0:5f7bc45bc2e8 | 59 | return NULL; |
ysuga | 0:5f7bc45bc2e8 | 60 | } |
ysuga | 0:5f7bc45bc2e8 | 61 | |
ysuga | 0:5f7bc45bc2e8 | 62 | |
ysuga | 0:5f7bc45bc2e8 | 63 | PortBase* RTnoProfile_getOutPort(const char* name, uint8_t nameLen) |
ysuga | 0:5f7bc45bc2e8 | 64 | { |
ysuga | 0:5f7bc45bc2e8 | 65 | for(uint8_t i = 0;i < MAX_PORT;i++) { |
ysuga | 0:5f7bc45bc2e8 | 66 | if(m_ppOutPort[i] == NULL) return NULL; |
ysuga | 0:5f7bc45bc2e8 | 67 | if(strncmp(name, m_ppOutPort[i]->pName, nameLen) == 0) { |
ysuga | 0:5f7bc45bc2e8 | 68 | return m_ppOutPort[i]; |
ysuga | 0:5f7bc45bc2e8 | 69 | } |
ysuga | 0:5f7bc45bc2e8 | 70 | } |
ysuga | 0:5f7bc45bc2e8 | 71 | return NULL; |
ysuga | 0:5f7bc45bc2e8 | 72 | } |
ysuga | 0:5f7bc45bc2e8 | 73 | |
ysuga | 0:5f7bc45bc2e8 | 74 | PortBase* RTnoProfile_getInPortByIndex(const uint8_t i) |
ysuga | 0:5f7bc45bc2e8 | 75 | { |
ysuga | 0:5f7bc45bc2e8 | 76 | return m_ppInPort[i]; |
ysuga | 0:5f7bc45bc2e8 | 77 | } |
ysuga | 0:5f7bc45bc2e8 | 78 | |
ysuga | 0:5f7bc45bc2e8 | 79 | PortBase* RTnoProfile_getOutPortByIndex(const uint8_t i) |
ysuga | 0:5f7bc45bc2e8 | 80 | { |
ysuga | 0:5f7bc45bc2e8 | 81 | return m_ppOutPort[i]; |
ysuga | 0:5f7bc45bc2e8 | 82 | } |