njb_send_file(3)
NAME
NJB_Send_File - transfer a datafile to the jukebox
LIBRARY
libnjb
SYNOPSIS
#include <sys/types.h> #include <libnjb.h> extern int njb_error int NJB_Send_File (njb_t *njb, const char *path, const char *name, XferCallback *callback, void *data, u_int32_t *fileid)
DESCRIPTION
- This function downloads the data file at path to the NJB.
- Data files are not music tracks, but general data storage con
- tainers on the jukebox. The name parameter is not required, if it
- is NULL, the path parameter will be used to name the sent file.
- Typically the name parameter should be sent to set a name which
- does not contain any path information or delimiters (like :, /
- etc).
- After the file is sucessfully transferred, the fileid
- variable is updated with the ID that was assigned by the NJB.
- This allows the calling program to update any local file caches.
- The callback parameter is a pointed to a callback func
- tion, as described in NJB_Get_File(3).
- The data parameter is a pointer to user data of any kind
- that the user of the library wants to associate with this trans
- fer. This pointer is used for example when accessing several dif
- ferent jukeboxes from withing one program. The XferCallback will
- also be delivering this pointer to the target routine for deref
- erencing. If this parameter is not used (in for example single
- device, single-threaded programs) it may be set to NULL.
- (On NJB1, this function increments the NJB's library
- counter, provided it has not been incremented previously during
- the session.)
RETURN VALUES
- If the transfer is successful, NJB_Send_File returns 0.
- Otherwise, -1 is returned and njb_error is set.
- EO_ABORTED
- The transfer was aborted by the user (the call
- back function returned -1).
- EO_BADCOUNT
- The library counter on the NJB could not be up
- dated. The file transfer was successful.
- EO_BADDATA
- datafiletag contains invalid data or is not
- properly formed.
- EO_BADSTATUS
- A non-zero status was returned by the NJB during
- the file transfer.
- EO_INVALID
- A required parameter was NULL.
- EO_NOMEM There was not enough memory to allocate the file
- transfer buffer.
- EO_NOMEM There was not enough memory to create the "tag"
- for the datafile.
- EO_RDSHORT
- The NJB sent fewer bytes than expected on the
- bulk data pipe.
- EO_TIMEOUT
- The NJB did not verify that the transfer was
- complete after several queries. The file may have still have
- been transferred successfully.
- EO_TOOBIG There is not enough free disk space on the NJB
- to hold the file.
- EO_USBBLK An I/O error occurred on the bulk data pipe.
- EO_USBCTL An I/O error occurred on the control pipe.
- EO_WRSHORT
- Fewer bytes than requested were written to the
- USB pipe.
- EO_XFERDENIED
- Could not determie the available disk space on
- the NJB.
- EO_XFERERROR
- The NJB returned a non-zero status when the tag
- for the datafile was transferred.
SEE ALSO
- NJB_Get_File(3), datafile(3), XferCallback(3)
- January 2003