ev3duder  0.3.0
EV3 Downloader/Uploader
funcs.h File Reference

contains declarations for ev3 commands More...

#include <stdio.h>
#include <stddef.h>

Go to the source code of this file.

Functions

General Usage
Parameters
[in]locLocal FILE*s
[in]remRemote EV3 UTF-8 encoded path strings
Return values
erroraccording 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 ()
 

Detailed Description

contains declarations for ev3 commands

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.

Function Documentation

int dl ( const char *  path,
FILE *  fp 
)

download remote source rem to local file loc

Parameters
pathpath on the ev3
fpFILE* to write data to
Return values
erroraccording 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_codeAn 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 listen ( )

Definition at line 7 of file listen.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]pathdirectory structure
Return values
erroraccording 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]bufbuffer with the bytecode
[in]cmdthe command to be executed
Return values
bytes_writtenbuffer size
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]pathpath/file to remove
Return values
erroraccording 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 
)

run remote .rbf file rem via VM

run remote .rbf file rem via VM

Parameters
[in]pathpath to file to execute
Return values
erroraccording to enum ERR
See also
http://ev3.fantastic.computer/doxygen/buildinapps.html
mkrbf()

Definition at line 30 of file run.c.

int tunnel ( )

tunnel stdio to established ev3 connection

tunnel stdio to established ev3 connection

Return values
err_codeAn 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]fpLocal FILE* to upload
[in]dstdestination path to upload to (UTF-8 encoded)
Return values
erroraccording to enum ERR
Bug:
might not handle files bigger than 2gb :-)

Definition at line 29 of file up.c.