blob: e1b7ef541685c3e2979406b5c9f5ad30ca1bf8ea [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001#ifndef AOS_COMMON_CONFIGURATION_H_
2#define AOS_COMMON_CONFIGURATION_H_
3
4#include "aos/aos_stdint.h"
5
6namespace aos {
7
8// Constants representing the various ports used for communications and some
9// documentation about what each is used for.
10enum 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
brians2fdfc072013-02-26 05:35:15 +000025// Holds global configuration data. All of the functions are safe to call
26// from wherever (the ones that need to create locks on the cRIO).
brians343bc112013-02-10 01:53:46 +000027namespace configuration {
28
29// Constants indentifying various devices on the network.
30enum class NetworkDevice {
31 // The computer that the cRIO talks to.
32 kAtom,
33 kCRIO,
Brian Silvermane1514fc2013-04-13 14:57:35 -070034 // Whatever device this is being run on.
35 kSelf,
brians343bc112013-02-10 01:53:46 +000036};
37// Returns the IP address to get to the specified machine.
38// The return value should be passed to free(3) if it is no longer needed.
39const char *GetIPAddress(NetworkDevice device);
40
brians2fdfc072013-02-26 05:35:15 +000041// Returns the "root directory" for this run. Under linux, this is the
42// directory where the executable is located (from /proc/self/exe) and under
43// vxworks it is just "/".
44// The return value will always be to a static string, so no freeing is
45// necessary.
46const char *GetRootDirectory();
47// Returns the directory where logs get written. Relative to GetRootDirectory().
48// The return value will always be to a static string, so no freeing is
49// necessary.
50const char *GetLoggingDirectory();
51
brians343bc112013-02-10 01:53:46 +000052} // namespace configuration
53} // namespace aos
54
55#endif