brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame^] | 1 | #ifndef AOS_COMMON_CONFIGURATION_H_ |
| 2 | #define AOS_COMMON_CONFIGURATION_H_ |
| 3 | |
| 4 | #include "aos/aos_stdint.h" |
| 5 | |
| 6 | namespace aos { |
| 7 | |
| 8 | // Constants representing the various ports used for communications and some |
| 9 | // documentation about what each is used for. |
| 10 | enum class NetworkPort : uint16_t { |
| 11 | // UDP socket sending motor values from the atom to the crio. |
| 12 | kMotors = 9710, |
| 13 | // UDP socket forwarding drivers station packets from the crio to the atom. |
| 14 | kDS = 9711, |
| 15 | // UDP socket sending sensor values from the crio to the atom. |
| 16 | kSensors = 9712, |
| 17 | // TCP socket(s) (automatically reconnects) sending logs from the crio to the |
| 18 | // atom. |
| 19 | kLogs = 9713, |
| 20 | // HTTP server that sends out camera feeds in mjpg format. |
| 21 | // Should not be changed because this number shows up elsewhere too. |
| 22 | kCameraStreamer = 9714, |
| 23 | }; |
| 24 | |
| 25 | // Holds global configuration data. All of the public static functions are safe |
| 26 | // to call concurrently (the ones that need to create locks on the cRIO). |
| 27 | namespace configuration { |
| 28 | |
| 29 | // Constants indentifying various devices on the network. |
| 30 | enum class NetworkDevice { |
| 31 | // The computer that the cRIO talks to. |
| 32 | kAtom, |
| 33 | kCRIO, |
| 34 | }; |
| 35 | // Returns the IP address to get to the specified machine. |
| 36 | // The return value should be passed to free(3) if it is no longer needed. |
| 37 | const char *GetIPAddress(NetworkDevice device); |
| 38 | |
| 39 | } // namespace configuration |
| 40 | } // namespace aos |
| 41 | |
| 42 | #endif |