libnjb: /tmp/libnjb-2.2.6/src/libnjb.h File Reference

# libnjb.h File Reference

`#include <sys/types.h>`
`#include <stdio.h>`
`#include <usb.h>`

Go to the source code of this file.

## Data Structures
struct | njb_struct
struct | njb_songid_frame_struct
struct | njb_songid_struct
struct | njb_playlist_track_struct
struct | njb_playlist_struct
struct | njb_datafile_struct
struct | njb_eax_struct
struct | njb_time_struct
struct | njb_keyval_struct
## Defines
#define | LIBNJB_VERSION 2.2.6
#define | LIBNJB_COMPILED_FOR_LIBUSB 1
#define | NJB_MAX_DEVICES 0xFF
#define | NJB_DEVICE_NJB1 0x00
#define | NJB_DEVICE_NJB2 0x01
#define | NJB_DEVICE_NJB3 0x02
#define | NJB_DEVICE_NJBZEN 0x03
#define | NJB_DEVICE_NJBZEN2 0x04
#define | NJB_DEVICE_NJBZENNX 0x05
#define | NJB_DEVICE_NJBZENXTRA 0x06
#define | NJB_DEVICE_DELLDJ 0x07
#define | NJB_DEVICE_NJBZENTOUCH 0x08
#define | NJB_DEVICE_NJBZENMICRO 0x09
#define | NJB_DEVICE_DELLDJ2 0x0a
#define | NJB_DEVICE_POCKETDJ 0x0b
#define | NJB_DEVICE_ZENSLEEK 0x0c
#define | NJB_DEVICE_CREATIVEZEN 0x0d
#define | NJB_DEVICE_DELLDJ3 0x0e
#define | NJB_TYPE_STRING 0x00
#define | NJB_TYPE_UINT16 0x02
#define | NJB_TYPE_UINT32 0x03
#define | NJB_CODEC_MP3 "MP3"
#define | NJB_CODEC_WMA "WMA"
#define | NJB_CODEC_WAV "WAV"
#define | NJB_CODEC_AA "AA"
#define | FR_SIZE "FILE SIZE"
#define | FR_LENGTH "LENGTH"
#define | FR_CODEC "CODEC"
#define | FR_TITLE "TITLE"
#define | FR_ALBUM "ALBUM"
#define | FR_GENRE "GENRE"
#define | FR_ARTIST "ARTIST"
#define | FR_TRACK "TRACK NUM"
#define | FR_FNAME "FNAME"
#define | FR_YEAR "YEAR"
#define | FR_PROTECTED "PlayOnly"
#define | FR_BITRATE "BITRATE"
#define | FR_COMMENT "COMMENT"
#define | FR_FOLDER "FOLDER"
#define | DD_USBCTL 1
#define | DD_USBBLKLIM 2
#define | DD_USBBLK 4
#define | DD_SUBTRACE 8
#define | NJB_UC_8859 0
#define | NJB_UC_UTF8 1
#define | NJB_TURBO_OFF 0
#define | NJB_TURBO_ON 1
#define | OWNER_STRING_LENGTH 128
#define | NJB_PL_NEW 0
#define | NJB_PL_UNCHANGED 1
#define | NJB_PL_CHNAME 2
#define | NJB_PL_CHTRACKS 3
#define | NJB_FILEFLAGS_REGULAR_FILE 0x80000000U
#define | NJB_Songid_Frame_New_Title(a) NJB_Songid_Frame_New_String(FR_TITLE, a)
#define | NJB_Songid_Frame_New_Album(a) NJB_Songid_Frame_New_String(FR_ALBUM, a)
#define | NJB_Songid_Frame_New_Genre(a) NJB_Songid_Frame_New_String(FR_GENRE, a)
#define | NJB_Songid_Frame_New_Artist(a) NJB_Songid_Frame_New_String(FR_ARTIST, a)
#define | NJB_Songid_Frame_New_Length(a) NJB_Songid_Frame_New_Uint16(FR_LENGTH, a)
#define | NJB_Songid_Frame_New_Filesize(a) NJB_Songid_Frame_New_Uint32(FR_SIZE, a)
#define | NJB_Songid_Frame_New_Tracknum(a) NJB_Songid_Frame_New_Uint16(FR_TRACK, a)
#define | NJB_Songid_Frame_New_Year(a) NJB_Songid_Frame_New_Uint16(FR_YEAR, a)
#define | NJB_Songid_Frame_New_Filename(a) NJB_Songid_Frame_New_String(FR_FNAME, a)
#define | NJB_Songid_Frame_New_Protected(a) NJB_Songid_Frame_New_Uint16(FR_PROTECTED, a)
#define | NJB_Songid_Frame_New_Bitrate(a) NJB_Songid_Frame_New_Uint32(FR_BITRATE, a)
#define | NJB_Songid_Frame_New_Comment(a) NJB_Songid_Frame_New_String(FR_COMMENT, a)
#define | NJB_Songid_Frame_New_Folder(a) NJB_Songid_Frame_New_String(FR_FOLDER, a)
#define | NJB_PL_END 0
#define | NJB_PL_START 1
#define | NJB_Get_File NJB_Get_Track
#define | NJB_Get_File_fd NJB_Get_Track_fd
## Typedefs
typedef unsigned char | owner_string [OWNER_STRING_LENGTH+1]
typedef struct njb_struct | njb_t
typedef struct njb_songid_frame_struct | njb_songid_frame_t
typedef struct njb_songid_struct | njb_songid_t
typedef struct njb_playlist_track_struct | njb_playlist_track_t
typedef struct njb_playlist_struct | njb_playlist_t
typedef struct njb_datafile_struct | njb_datafile_t
typedef struct njb_eax_struct | njb_eax_t
typedef struct njb_time_struct | njb_time_t
typedef struct njb_keyval_struct | njb_keyval_t
typedef int | NJB_Xfer_Callback (u_int64_t sent, u_int64_t total, const char *buf, unsigned len, void *data)
## Enumerations
enum | njb_eax_control_t { NJB_EAX_NO_CONTROL, NJB_EAX_SLIDER_CONTROL, NJB_EAX_FIXED_OPTION_CONTROL }
## Functions
void | NJB_Set_Debug (int debug_flags)
void | NJB_Set_Unicode (int unicode_flag)
int | NJB_Error_Pending (njb_t *njb)
void | NJB_Error_Reset_Geterror (njb_t *njb)
const char * | NJB_Error_Geterror (njb_t *njb)
void | NJB_Error_Dump (njb_t *njb, FILE *fp)
int | NJB_Discover (njb_t *njbs, int limit, int *n)
int | NJB_Open (njb_t *njb)
void | NJB_Close (njb_t *njb)
int | NJB_Capture (njb_t *njb)
int | NJB_Release (njb_t *njb)
void | NJB_Ping (njb_t *njb)
int | NJB_Get_Disk_Usage (njb_t *njb, u_int64_t *btotal, u_int64_t *bfree)
char * | NJB_Get_Owner_String (njb_t *njb)
int | NJB_Set_Owner_String (njb_t *njb, const char *name)
int | NJB_Get_Bitmap_Dimensions (njb_t *njb, int *x, int *y, int *bytes)
int | NJB_Set_Bitmap (njb_t *njb, const unsigned char *bitmap)
njb_keyval_t * | NJB_Get_Keys (njb_t *njb)
u_int64_t | NJB_Get_NJB1_Libcounter (njb_t *njb)
int | NJB_Send_Firmware (njb_t *njb, const char *path, NJB_Xfer_Callback *callback, void *data)
int | NJB_Get_Battery_Level (njb_t *njb)
int | NJB_Get_Battery_Charging (njb_t *njb)
int | NJB_Get_Auxpower (njb_t *njb)
int | NJB_Get_SDMI_ID (njb_t *njb, u_int8_t *sdmiid)
const char * | NJB_Get_Device_Name (njb_t *njb, int type)
int | NJB_Get_Firmware_Revision (njb_t *njb, u_int8_t *major, u_int8_t *minor, u_int8_t *release)
int | NJB_Get_Hardware_Revision (njb_t *njb, u_int8_t *major, u_int8_t *minor, u_int8_t *release)
int | NJB_Set_Turbo_Mode (njb_t *njb, u_int8_t mode)
njb_songid_t * | NJB_Songid_New (void)
void | NJB_Songid_Destroy (njb_songid_t *song)
void | NJB_Songid_Addframe (njb_songid_t *song, njb_songid_frame_t *frame)
void | NJB_Songid_Reset_Getframe (njb_songid_t *song)
njb_songid_frame_t * | NJB_Songid_Getframe (njb_songid_t *song)
njb_songid_frame_t * | NJB_Songid_Findframe (njb_songid_t *song, const char *label)
njb_songid_frame_t * | NJB_Songid_Frame_New_String (const char *label, const char *value)
njb_songid_frame_t * | NJB_Songid_Frame_New_Uint16 (const char *label, u_int16_t value)
njb_songid_frame_t * | NJB_Songid_Frame_New_Uint32 (const char *label, u_int32_t value)
njb_songid_frame_t * | NJB_Songid_Frame_New_Codec (const char *value)
void | NJB_Songid_Frame_Destroy (njb_songid_frame_t *frame)
void | NJB_Get_Extended_Tags (njb_t *njb, int extended)
void | NJB_Reset_Get_Track_Tag (njb_t *njb)
njb_songid_t * | NJB_Get_Track_Tag (njb_t *njb)
int | NJB_Replace_Track_Tag (njb_t *njb, u_int32_t trackid, njb_songid_t *songid)
int | NJB_Get_Track (njb_t *njb, u_int32_t trackid, u_int32_t size, const char *path, NJB_Xfer_Callback *callback, void *data)
int | NJB_Get_Track_fd (njb_t *njb, u_int32_t trackid, u_int32_t size, int fd, NJB_Xfer_Callback *callback, void *data)
int | NJB_Send_Track (njb_t *njb, const char *path, njb_songid_t *songid, NJB_Xfer_Callback *callback, void *data, u_int32_t *trackid)
int | NJB_Delete_Track (njb_t *njb, u_int32_t trackid)
void | NJB_Reset_Get_Playlist (njb_t *njb)
njb_playlist_t * | NJB_Get_Playlist (njb_t *njb)
int | NJB_Delete_Playlist (njb_t *njb, u_int32_t plid)
int | NJB_Update_Playlist (njb_t *njb, njb_playlist_t *pl)
njb_playlist_t * | NJB_Playlist_New (void)
void | NJB_Playlist_Destroy (njb_playlist_t *pl)
void | NJB_Playlist_Addtrack (njb_playlist_t *pl, njb_playlist_track_t *track, unsigned int pos)
void | NJB_Playlist_Reset_Gettrack (njb_playlist_t *pl)
njb_playlist_track_t * | NJB_Playlist_Gettrack (njb_playlist_t *pl)
int | NJB_Playlist_Set_Name (njb_playlist_t *pl, const char *name)
void | NJB_Playlist_Deltrack (njb_playlist_t *pl, unsigned int pos)
void | NJB_Playlist_Deltrack_TrackID (njb_playlist_t *pl, u_int32_t trackid)
njb_playlist_track_t * | NJB_Playlist_Track_New (u_int32_t trackid)
void | NJB_Playlist_Track_Destroy (njb_playlist_track_t *track)
void | NJB_Reset_Get_Datafile_Tag (njb_t *njb)
njb_datafile_t * | NJB_Get_Datafile_Tag (njb_t *njb)
void | NJB_Datafile_Destroy (njb_datafile_t *df)
int | NJB_Send_File (njb_t *njb, const char *path, const char *name, const char *folder, NJB_Xfer_Callback *callback, void *data, u_int32_t *fileid)
int | NJB_Delete_Datafile (njb_t *njb, u_int32_t fileid)
int | NJB_Create_Folder (njb_t *njb, const char *name, u_int32_t *folderid)
void | NJB_Reset_Get_EAX_Type (njb_t *njb)
njb_eax_t * | NJB_Get_EAX_Type (njb_t *njb)
void | NJB_Destroy_EAX_Type (njb_eax_t *eax)
void | NJB_Adjust_EAX (njb_t *njb, u_int16_t eaxid, u_int16_t patchindex, int16_t scalevalue)
njb_time_t * | NJB_Get_Time (njb_t *njb)
int | NJB_Set_Time (njb_t *njb, njb_time_t *time)
void | NJB_Destroy_Time (njb_time_t *time)
int | NJB_Play_Track (njb_t *njb, u_int32_t trackid)
int | NJB_Queue_Track (njb_t *njb, u_int32_t trackid)
int | NJB_Stop_Play (njb_t *njb)
int | NJB_Pause_Play (njb_t *njb)
int | NJB_Resume_Play (njb_t *njb)
int | NJB_Seek_Track (njb_t *njb, u_int32_t position)
int | NJB_Elapsed_Time (njb_t *njb, u_int16_t *elapsed, int *change)

## Detailed Description

Interface to the Nomad Jukebox library libnjb, handles most models. Also handles the Dell Digital Jukebox. This file should be included by programs that want to use libnjb, e.g.:

`include <libnjb.h>`

## Define Documentation

#define LIBNJB_COMPILED_FOR_LIBUSB 1

A legacy definition - nowadays we always compile for libusb

#define LIBNJB_VERSION 2.2.6

The version of this installation of libnjb

#define NJB_FILEFLAGS_REGULAR_FILE 0x80000000U

This definition corresponds to the standard file permissions set for most files transferred from Windows machines to the device "file system" (file database). Can be used as a template to simplify things.

Referenced by datafile_unpack().

#define NJB_MAX_DEVICES 0xFF

The maximum number of devices that can be found by libnjb

Examples:
  cursesplay.c, delfile.c, deltr.c, dumpeax.c, dumptime.c, files.c, fwupgrade.c, getfile.c, getowner.c, gettr.c, getusage.c, handshake.c, pl.c, play.c, playlists.c, sendfile.c, sendtr.c, setowner.c, setpbm.c, settime.c, tagtr.c, and tracks.c.

#define NJB_PL_CHNAME 2

This playlist has changed name

Referenced by NJB_Playlist_Set_Name(), and NJB_Update_Playlist().

#define NJB_PL_CHTRACKS 3

This playlist has a new track listing

Referenced by NJB_Playlist_Addtrack(), NJB_Playlist_Deltrack(), NJB_Playlist_Deltrack_TrackID(), and NJB_Update_Playlist().

#define NJB_PL_NEW 0

This playlist is new

Referenced by NJB_Playlist_Addtrack(), NJB_Playlist_New(), and NJB_Update_Playlist().

#define NJB_PL_UNCHANGED 1

This playlist has not changed

Referenced by NJB_Playlist_Set_Name(), NJB_Update_Playlist(), and playlist_unpack().

#define OWNER_STRING_LENGTH 128

The fixed length of the owner string

Referenced by NJB_Set_Owner_String().

## Typedef Documentation

typedef int NJB_Xfer_Callback(u_int64_t sent, u_int64_t total, const char *buf, unsigned len, void *data)

The callback type

typedef unsigned char owner_string[OWNER_STRING_LENGTH+1]

A type defined for owner strings

## Enumeration Type Documentation

enum njb_eax_control_t

This is the EAX Control Type