projects:high_altitude_slug:software:protocol
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
projects:high_altitude_slug:software:protocol [2006/07/08 10:44] – (old revision restored) 127.0.0.1 | projects:high_altitude_slug:software:protocol [2008/07/19 23:33] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 6: | Line 6: | ||
===== Commands ===== | ===== Commands ===== | ||
- | We have a 16 unsigned integer for commands: | + | We have a 16 bit unsigned integer for commands: |
==== Human messages (0 - 9) ==== | ==== Human messages (0 - 9) ==== | ||
- | * [0 - 9] CMD_MESSAGE_[0-9] | + | * [0 - 9] CMD_MESSAGE_[0-9] |
- | ==== All processes | + | ==== All processes |
+ | * 10 CMD_ERROR int - Error occured | ||
+ | ==== GPS reader ==== | ||
+ | * 5000 CMD_GPS_DATA struct gps_data - GPS data | ||
- | ==== GPS reader | + | ==== Thermopile |
+ | * 5500 CMD_THERMOPILE_DATA struct thermopile_data - Thermopile data | ||
==== Flight management (6000 - 6999) ==== | ==== Flight management (6000 - 6999) ==== | ||
+ | * 6000 CMD_STATUS int - Status of flight has changed, one of: | ||
+ | * 0 - Flight not started | ||
+ | * 1 - Ascent | ||
+ | * 2 - Descent | ||
+ | * 3 - Descent with parachute released | ||
+ | * 4 - Landed | ||
+ | * 6001 CMD_PARACHUTE bool - Parachute released if size > 0, else a request to release | ||
+ | * 6003 CMD_CUTDOWN bool - Glider has been cutdown if size > 0, else a request to release | ||
+ | * 6005 CMD_DESIRED_HEADING double - The desired heading calculated by the flight management. | ||
+ | * 6006 CMD_ALT_DROP_POSITION int - 0 - not in altitude drop, 1-4, position from north clockwise | ||
+ | * 6007 CMD_FINAL_WAYPOINT waypoint_t - The final waypoint, generally the launch point | ||
- | ==== Roll control | + | ==== Roll control ==== |
- | * 7000 CMD_DESIRED_HEADING double - The desired heading calculated by the flight management. | + | ==== Pitch control ==== |
- | ==== Pitch control (8000 - 8999) ==== | + | ==== Configuration |
+ | See configuration files for descriptions and categorisation. | ||
- | ===== Client Library Functions ===== | + | |
- | ==== client_init ==== | + | to be finished |
- | The '' | + | |
- | int client_init (char *serverAddr, unsigned short port); | + | |
- | in client.h | + | |
- | + | ||
- | On success '' | + | |
- | + | ||
- | ==== client_recv_packet ==== | + | |
- | The '' | + | |
- | int client_recv_packet (unsigned short serverFD, struct client_packet *packet); | + | |
- | in client.h | + | |
- | + | ||
- | The '' | + | |
- | + | ||
- | First of all the function will read 4 bytes of data from the '' | + | |
- | + | ||
- | **Please note the the data segment of the packet ('' | + | |
- | + | ||
- | On success this function will return 0 while on failure this function will return -1 and will make a note in the error log about exactly what went wrong. | + | |
- | + | ||
- | ==== client_recv_packets ==== | + | |
- | The '' | + | |
- | struct client_packet *client_recv_packets(unsigned short serverFD, int *npackets); | + | |
- | in client.h | + | |
- | + | ||
- | Since this function makes calls to the '' | + | |
- | + | ||
- | On success this function returns a pointer to a '' | + | |
- | + | ||
- | ==== client_send_packet ==== | + | |
- | The '' | + | |
- | int client_send_packet (unsigned short serverFD, struct client_packet *packet); | + | |
- | in client.h | + | |
- | + | ||
- | Like the '' | + | |
- | + | ||
- | On success the function will return 0 otherwise, on failure, will return -1 and make a note in the error log about what went wrong. | + | |
- | + | ||
- | ==== client_close ==== | + | |
- | The '' | + | |
- | void client_close (unsigned short serverFD) | + | |
- | in client.h | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | ===== Example Application ===== | + | |
- | Here is a simple application that demonstrates the use of these functions. The program basically forks (creates a copy of) itself. Both of the processes then connect to the server, once a connection has been established the child process will then wait for 0.25 seconds, giving the parent process time to send two packets of data to the party line at which point the parent process then exits. After the child processes 0.25 second wait has elapsed it will call the '' | + |
projects/high_altitude_slug/software/protocol.1152355492.txt.gz · Last modified: 2008/07/19 23:31 (external edit)