contains declarations for ev3 commands
More...
#include <stdio.h>
#include <stddef.h>
Go to the source code of this file.
|
|
- Parameters
-
[in] | loc | Local FILE*s |
[in] | rem | Remote EV3 UTF-8 encoded path strings |
- Return values
-
error | according to enum ERR |
|
int | up (FILE *loc, const char *rem) |
| upload local file loc to remote destination rem More...
|
|
int | dl (const char *rem, FILE *loc) |
| download remote source rem to local file loc More...
|
|
int | info (const char *arg) |
| print connection information, beep and exit More...
|
|
int | run (const char *rem, unsigned timeout) |
| run remote .rbf file rem via VM More...
|
|
int | ls (const char *rem) |
| list contents of remote directory rem More...
|
|
int | rm (const char *rem) |
| remove remote file or directory rem More...
|
|
int | mkdir (const char *rem) |
| create directory rem on remote system More...
|
|
size_t | mkrbf (char **buf, const char *cmd) |
| fill *buf with a rbf file executing cmd More...
|
|
int | tunnel () |
| tunnel stdio to established ev3 connection More...
|
|
int | listen () |
|
contains declarations for ev3 commands
- Copyright
- (c) 2015 Ahmad Fatoum. Code available under terms of the GNU General Public License 3.0 All commands take FILE* loc arguments for loc files and UTF-8 encoded rem file names, if any. On POSIX, this needs no changes. On Windows, for multibyte input UCS-2 to UTF-8 conversion would need to be handled by caller
- See also
- branch win32-unicode for a possible way to implement
main
. All calls to these functions should be in main.c
- Author
- Ahmad Fatoum
- Warning
- unless otherwise stated, passing
NULL
to a function is undefined behavior.
Definition in file funcs.h.
int dl |
( |
const char * |
path, |
|
|
FILE * |
fp |
|
) |
| |
download remote source rem
to local file loc
- Parameters
-
path | path on the ev3 |
fp | FILE* to write data to |
- Return values
-
error | according to enum ERR |
Definition at line 26 of file dl.c.
int info |
( |
const char * |
arg | ) |
|
print connection information, beep and exit
print connection information, beep and exit
- Return values
-
err_code | An error code according to enum ERR |
- Bug:
- needs more detailed information for bluetooth/wlan should print COM port, device name
Definition at line 36 of file info.c.
int ls |
( |
const char * |
rem | ) |
|
list contents of remote directory rem
Definition at line 36 of file ls.c.
int mkdir |
( |
const char * |
path | ) |
|
create directory rem
on remote system
create directory rem
on remote system
- Parameters
-
[in] | path | directory structure |
- Return values
-
error | according to enum ERR |
- See also
- your man pages for
mkdir
- Note
- The VM will choke to death when you excede the ASCII subset of UTF-8 Do NOT use any non ASCII letters if you want the LEGO menu to stay responsible. In case of fudging up,
ev3duder
rm() can delete directories too
Definition at line 29 of file mkdir.c.
size_t mkrbf |
( |
char ** |
buf, |
|
|
const char * |
cmd |
|
) |
| |
fill *buf
with a rbf file executing cmd
fill *buf
with a rbf file executing cmd
- Parameters
-
[out] | buf | buffer with the bytecode |
[in] | cmd | the command to be executed |
- Return values
-
- Warning
- Command is passed unsanitized to root shell. Handle with care
Definition at line 29 of file mkrbf.c.
int rm |
( |
const char * |
path | ) |
|
remove remote file or directory rem
remove remote file or directory rem
- Parameters
-
[in] | path | path/file to remove |
- Return values
-
error | according to enum ERR |
- Warning
- removing system files will lock up the device/VM. don't do it
Definition at line 27 of file rm.c.
int run |
( |
const char * |
exec, |
|
|
unsigned |
timeout |
|
) |
| |
tunnel stdio to established ev3 connection
tunnel stdio to established ev3 connection
- Return values
-
err_code | An error code according to enum ERR
- If stdio is connected to a terminal, packets can be entered in hex and submitted with a line break. non-graphical characters, including whitespace, are ignored. If the first 4 bytes can't be parsed as hex digits, they are replaced with the binary length. Any other character is replaced with a nibble rounded up.
- If stdio is a pipe, the first 2 bytes are read to acquire packet length and then an equal amount of bytes is read and sent to the ev3
|
Definition at line 35 of file tunnel.c.
int up |
( |
FILE * |
fp, |
|
|
const char * |
dst |
|
) |
| |
upload local file loc
to remote destination rem
upload local file loc
to remote destination rem
- Parameters
-
[in] | fp | Local FILE* to upload |
[in] | dst | destination path to upload to (UTF-8 encoded) |
- Return values
-
error | according to enum ERR |
- Bug:
- might not handle files bigger than 2gb :-)
Definition at line 29 of file up.c.