| 1 | #ifndef SOCKETS_H |
|---|
| 2 | #define SOCKETS_H |
|---|
| 3 | |
|---|
| 4 | #include <stdlib.h> |
|---|
| 5 | |
|---|
| 6 | #ifndef LCDPORT |
|---|
| 7 | #define LCDPORT 13666 |
|---|
| 8 | #endif |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | /* |
|---|
| 13 | Socket functions available to server and clients... |
|---|
| 14 | (ignore the rest of the comments... I was babbling out random ideas) |
|---|
| 15 | |
|---|
| 16 | This should have stuff to read/write sockets, open/close them, etc... |
|---|
| 17 | */ |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | // Client functions... |
|---|
| 21 | int sock_connect(char *host, unsigned short int port); |
|---|
| 22 | int sock_close(int fd); |
|---|
| 23 | // Send/receive lines of text |
|---|
| 24 | int sock_send_string(int fd, char *string); |
|---|
| 25 | // Recv gives only one line per call... |
|---|
| 26 | int sock_recv_string(int fd, char *dest, size_t maxlen); |
|---|
| 27 | // Send/receive raw data |
|---|
| 28 | int sock_send(int fd, void *src, size_t size); |
|---|
| 29 | int sock_recv(int fd, void *dest, size_t maxlen); |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | // Er, ignore the rest of this file. I'll clean it up sometime... |
|---|
| 33 | |
|---|
| 34 | /***************************************************************** |
|---|
| 35 | LCDproc command line interface?: (while running) |
|---|
| 36 | |
|---|
| 37 | -command |
|---|
| 38 | Tells LCDproc to interpret stdin as raw commands to send through |
|---|
| 39 | the socket. Input must be formatted as above, in socket interface. |
|---|
| 40 | -function f |
|---|
| 41 | Runs LCDproc external function f, where f is one of the predefined |
|---|
| 42 | functions which can be assigned to keypad keys. (like NEXTMODE, etc) |
|---|
| 43 | -key x |
|---|
| 44 | Simulates keypad press of key 'x', where 'x' is (A-Z). |
|---|
| 45 | -print [time] |
|---|
| 46 | Prints stdin on LCD one line at a time, with no line-wrapping (raw), |
|---|
| 47 | with [time] frames between updates (lines). |
|---|
| 48 | -wrap [time] |
|---|
| 49 | Prints stdin as with "-print", but with line wrapping when possible. |
|---|
| 50 | -contrast xxx |
|---|
| 51 | Sets contrast to xxx (decimal) |
|---|
| 52 | -backlight [on/off] |
|---|
| 53 | Turns backlight [on/off/auto], or toggles it. |
|---|
| 54 | If [off], stays off. |
|---|
| 55 | If [on], stays on. |
|---|
| 56 | If [auto], LCDproc controls backlight based on load, etc... |
|---|
| 57 | -exit |
|---|
| 58 | -quit |
|---|
| 59 | Duh... :) |
|---|
| 60 | |
|---|
| 61 | ******************************************************************/ |
|---|
| 62 | |
|---|
| 63 | /***************************************************************** |
|---|
| 64 | LCDproc stuff supported in config file (loose approximation): |
|---|
| 65 | |
|---|
| 66 | Grammar is tcl-style. I.e., "command arg1 arg2 ...". |
|---|
| 67 | Spaces are used as argument separators, *until* it thinks it has the final |
|---|
| 68 | argument. So, "function thing shell myprogram arg1 arg2 arg3" would be |
|---|
| 69 | split into "function", "thing", "shell", and "myprogram arg1 arg2 arg3". |
|---|
| 70 | |
|---|
| 71 | User-definable functions (use built-in's to create new ones?): |
|---|
| 72 | Function mp3NextSong Shell /usr/local/bin/mp3player -next |
|---|
| 73 | Function MySequence Sequence cpu mem xload |
|---|
| 74 | Function OtherSequence Sequence time cd xload |
|---|
| 75 | |
|---|
| 76 | Keypad keys can be bound to any _function_: |
|---|
| 77 | Key A mp3NextSong |
|---|
| 78 | Key B HaltSystem |
|---|
| 79 | Key C Menu |
|---|
| 80 | Key D Next/+ |
|---|
| 81 | Key E OtherSequence |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | ******************************************************************/ |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | #endif |
|---|