blob: 2f7e777b8fc88c587b7a280db8d5c22fc42f5d45 [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,
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.
37const char *GetIPAddress(NetworkDevice device);
38
brians2fdfc072013-02-26 05:35:15 +000039// Returns the "root directory" for this run. Under linux, this is the
40// directory where the executable is located (from /proc/self/exe) and under
41// vxworks it is just "/".
42// The return value will always be to a static string, so no freeing is
43// necessary.
44const char *GetRootDirectory();
45// Returns the directory where logs get written. Relative to GetRootDirectory().
46// The return value will always be to a static string, so no freeing is
47// necessary.
48const char *GetLoggingDirectory();
49
brians343bc112013-02-10 01:53:46 +000050} // namespace configuration
51} // namespace aos
52
53#endif