1 #ifndef __NJB__PROTO__H
2 #define __NJB__PROTO__H
33 int reset_get_track_tag;
34 int reset_get_playlist;
35 int reset_get_datafile_tag;
49 #define NJB_POWER_BATTERY 0x00
50 #define NJB_POWER_AC_CHARGED 0x01
52 #define NJB_POWER_AC_CHARGING 0x03
55 #define NJB_XFER_BLOCK_SIZE 0x0000FE00
56 #define NJB_XFER_BLOCK_HEADER_SIZE 68
58 #define NJB_RELEASE 0x00
59 #define NJB_CAPTURE 0x01
61 #define NJB_CMD_PING 0x01
62 #define NJB_CMD_GET_DISK_USAGE 0x04
63 #define NJB_CMD_GET_FIRST_TRACK_TAG_HEADER 0x06
64 #define NJB_CMD_GET_NEXT_TRACK_TAG_HEADER 0x07
65 #define NJB_CMD_GET_TRACK_TAG 0x09
66 #define NJB_CMD_SEND_TRACK_TAG 0x0a
67 #define NJB_CMD_DELETE_TRACK 0x0b
68 #define NJB_CMD_REPLACE_TRACK_TAG 0x0c
69 #define NJB_CMD_REQUEST_TRACK 0x0d
70 #define NJB_CMD_TRANSFER_COMPLETE 0x0e
71 #define NJB_CMD_SEND_FILE_BLOCK 0x0f
72 #define NJB_CMD_RECEIVE_FILE_BLOCK 0x10
73 #define NJB_CMD_GET_FIRST_PLAYLIST_HEADER 0x11
74 #define NJB_CMD_GET_NEXT_PLAYLIST_HEADER 0x12
75 #define NJB_CMD_GET_PLAYLIST 0x14
76 #define NJB_CMD_CREATE_PLAYLIST 0x15
77 #define NJB_CMD_DELETE_PLAYLIST 0x16
78 #define NJB_CMD_ADD_TRACK_TO_PLAYLIST 0x17
79 #define NJB_CMD_QUEUE_TRACK 0x1b
80 #define NJB_CMD_PLAY_TRACK 0x1d
81 #define NJB_CMD_STOP_PLAY 0x1e
82 #define NJB_CMD_ELAPSED_TIME 0x22
83 #define NJB_CMD_ADJUST_SOUND 0x23
84 #define NJB_CMD_GET_TIME 0x29
85 #define NJB_CMD_SET_TIME 0x2a
86 #define NJB_CMD_CAPTURE_NJB 0x2b
87 #define NJB_CMD_RELEASE_NJB 0x2c
88 #define NJB_CMD_GET_EAX_SIZE 0x3a
89 #define NJB_CMD_GET_EAX 0x24
90 #define NJB_CMD_RENAME_PLAYLIST 0x40
91 #define NJB_CMD_SET_OWNER_STRING 0x41
92 #define NJB_CMD_GET_OWNER_STRING 0x42
93 #define NJB_CMD_GET_LIBRARY_COUNTER 0x43
94 #define NJB_CMD_SET_LIBRARY_COUNTER 0x44
95 #define NJB_CMD_ADD_MULTIPLE_TRACKS_TO_PLAYLIST 0x46
96 #define NJB_CMD_SEND_DATAFILE_TAG 0x48
97 #define NJB_CMD_DELETE_DATAFILE 0x49
98 #define NJB_CMD_GET_FIRST_DATAFILE_HEADER 0x4a
99 #define NJB_CMD_GET_NEXT_DATAFILE_HEADER 0x4b
100 #define NJB_CMD_GET_DATAFILE_TAG 0x4d
101 #define NJB_CMD_VERIFY_LAST_CMD 0xf0
102 #define NJB_CMD_CAPTURE_NJB3 0xfd
103 #define NJB_CMD_RELEASE_NJB3 0xfe
104 #define NJB_CMD_UNKNOWN_NJB3 0xff
106 #define NJB_VAL_GET_EAX 0x00
107 #define NJB_VAL_GET_EAX_UNKNOWN 0x01
109 #define NJB_SOUND_SET_VOLUME 0x01
110 #define NJB_SOUND_SET_BASS 0x02
111 #define NJB_SOUND_SET_TREBLE 0x03
112 #define NJB_SOUND_SET_MUTING 0x04
113 #define NJB_SOUND_SET_MIDRANGE 0x05
114 #define NJB_SOUND_SET_MIDFREQ 0x06
115 #define NJB_SOUND_SET_EAX 0x07
116 #define NJB_SOUND_SET_EAXAMT 0x08
117 #define NJB_SOUND_SET_HEADPHONE 0x09
118 #define NJB_SOUND_SET_REAR 0x0A
119 #define NJB_SOUND_SET_EQSTATUS 0x0D
121 #define NJB_MSG_OKAY 0x00
122 #define NJB_ERR_FAILED 0x01
123 #define NJB_ERR_DEVICE_BUSY 0x02
124 #define NJB_ERR_STORAGE_FULL 0x03
125 #define NJB_ERR_HD_GENERAL_ERROR 0x04
126 #define NJB_ERR_SETTIME_REJECTED 0x05
128 #define NJB_ERR_TRACK_NOT_FOUND 0x10
129 #define NJB_ERR_TRACK_EXISTS 0x11
130 #define NJB_ERR_TITLE_MISSING 0x12
131 #define NJB_ERR_CODEC_MISSING 0x13
132 #define NJB_ERR_SIZE_MISSING 0x14
133 #define NJB_ERR_IO_OPERATION_ABORTED 0x15
134 #define NJB_ERR_READ_WRITE_ERROR 0x16
135 #define NJB_ERR_NOT_OPENED 0x17
136 #define NJB_ERR_UPLOAD_DENIED 0x18
138 #define NJB_ERR_PLAYLIST_NOT_FOUND 0x20
139 #define NJB_ERR_PLAYLIST_EXISTS 0x21
140 #define NJB_ERR_PLAYLIST_ITEM_NOT_FOUND 0x22
141 #define NJB_ERR_PLAYLIST_ITEM_EXISTS 0x23
143 #define NJB_MSG_QUEUED_AUDIO_STARTED 0x30
144 #define NJB_MSG_PLAYER_FINISHED 0x31
146 #define NJB_ERR_QUEUE_ALREADY_EMPTY 0x40
147 #define NJB_ERR_VOLUME_CONTROL_UNAVAILABLE 0x42
149 #define NJB_ERR_DATA_NOT_FOUND 0x60
150 #define NJB_ERR_DATA_NOT_OPENED 0x67
152 #define NJB_ERR_PLAYER_NOT_CONNECTED 0x80
153 #define NJB_ERR_CANCELLED 0x81
154 #define NJB_ERR_PORT_NOT_AVAILABLE 0x82
155 #define NJB_ERR_OUT_OF_MEMORY 0x83
156 #define NJB_ERR_FILEOPEN_ERR 0x84
157 #define NJB_ERR_ITEM_NOT_FOUND 0x85
158 #define NJB_ERR_LOAD_COMPONENTS_FAILED 0x86
159 #define NJB_ERR_ID_INVALID 0x87
160 #define NJB_ERR_FILETYPE_ILLEGAL 0x88
161 #define NJB_ERR_LOADRES_FAIL 0x89
162 #define NJB_ERR_FORMAT_NOT_FOUND 0x8a
163 #define NJB_ERR_FILE_ALREADY_EXISTS 0x8b
164 #define NJB_ERR_LIB_CORRUPTED 0x8c
165 #define NJB_ERR_LIB_BUSY 0x8d
166 #define NJB_ERR_FILE_READ_WRITE_FAILED 0x8e
167 #define NJB_ERR_INVALID_FILEPATH 0x8f
168 #define NJB_ERR_DISKFULL_FOR_DOWNLOAD 0x90
169 #define NJB_ERR_FILE_PLAYONLY 0x91
171 #define NJB_ERR_UNDEFINED_ERR 0xff
172 #define NJB_ERR_NOT_IMPLEMENTED 0x100
183 int njb_reset_get_songlist (
njb_t *njb);
187 int njb_request_file (
njb_t *njb, u_int32_t fileid);
188 int njb_transfer_complete (
njb_t *njb);
192 int njb_add_track_to_playlist (
njb_t *njb, u_int32_t plid, u_int32_t trid);
193 int njb_add_multiple_tracks_to_playlist (
njb_t *njb, u_int32_t plid,
194 u_int32_t *trids, u_int16_t ntracks);
195 int njb_delete_track (
njb_t *njb, u_int32_t trackid);
196 int njb_delete_datafile (
njb_t *njb, u_int32_t fileid);
198 int njb_create_playlist (
njb_t *njb,
char *name, u_int32_t *plid);
199 int njb_delete_playlist (
njb_t *njb, u_int32_t plid);
200 int njb_rename_playlist (
njb_t *njb, u_int32_t plid,
char *name);
202 int njb_get_eax_size (
njb_t *njb, u_int32_t *size);
209 u_int32_t njb_send_file_block (
njb_t *njb,
void *data, u_int32_t blocksize);
213 #define njb_get_first_track_tag_header(a,b) njb_get_track_tag_header(a,b,NJB_CMD_GET_FIRST_TRACK_TAG_HEADER)
214 #define njb_get_next_track_tag_header(a,b) njb_get_track_tag_header(a,b,NJB_CMD_GET_NEXT_TRACK_TAG_HEADER)
218 #define njb_get_first_playlist_header(a,b) njb_get_playlist_header(a,b,NJB_CMD_GET_FIRST_PLAYLIST_HEADER)
219 #define njb_get_next_playlist_header(a,b) njb_get_playlist_header(a,b,NJB_CMD_GET_NEXT_PLAYLIST_HEADER)
223 #define njb_get_first_datafile_header(a,b) njb_get_datafile_header(a,b,NJB_CMD_GET_FIRST_DATAFILE_HEADER);
224 #define njb_get_next_datafile_header(a,b) njb_get_datafile_header(a,b,NJB_CMD_GET_NEXT_DATAFILE_HEADER);
227 #define njb_play_track(a,b) njb_play_or_queue(a,b,NJB_CMD_PLAY_TRACK)
228 #define njb_queue_track(a,b) njb_play_or_queue(a,b,NJB_CMD_QUEUE_TRACK)
229 int njb_play_or_queue (
njb_t *njb, u_int32_t trackid,
int cmd);
230 int njb_stop_play (
njb_t *njb);
231 int njb_elapsed_time (
njb_t *njb, u_int16_t *elapsed,
int *change);
232 int njb_adjust_sound(
njb_t *njb, u_int8_t effect, int16_t value);
void * time_pack(njb_time_t *time)
Definition: njbtime.c:100
int njb_init_state(njb_t *njb)
Definition: protocol.c:43
Definition: protocol.h:28
u_int8_t fwMinor
Definition: protocol.h:43
njb_eax_t * next
Definition: libnjb.h:394
void from_64bit_to_njb1_bytes(u_int64_t val, unsigned char *dp)
Definition: byteorder.c:52
#define EO_TOOBIG
Definition: njb_error.h:22
void * protocol_state
Definition: libnjb.h:192
void from_16bit_to_njb1_bytes(u_int16_t val, unsigned char *dp)
Definition: byteorder.c:183
int __sub_depth
Definition: base.c:62
ssize_t usb_pipe_write(njb_t *njb, void *buf, size_t nbytes)
Definition: usb_io.c:67
#define EO_BADSTATUS
Definition: njb_error.h:17
Definition: protocol.h:11
#define OWNER_STRING_LENGTH
Definition: libnjb.h:160
u_int32_t njb_receive_file_block(njb_t *njb, u_int32_t offset, u_int32_t bsize, void *bp)
Definition: protocol.c:814
void njb_read_eaxtypes(njb_t *njb, u_int32_t size)
Definition: protocol.c:1199
int njb_capture(njb_t *njb, int which)
Definition: protocol.c:373
#define EO_USBBLK
Definition: njb_error.h:12
#define EO_NOMEM
Definition: njb_error.h:14
u_int32_t dfid
Definition: libnjb.h:323
u_int8_t power
Definition: protocol.h:37
unsigned char owner_string[OWNER_STRING_LENGTH+1]
Definition: libnjb.h:162
#define EO_USBCTL
Definition: njb_error.h:11
int njb_get_library_counter(njb_t *njb, njblibctr_t *lcount)
Definition: protocol.c:241
njb_time_t * time_unpack(void *data)
Definition: njbtime.c:25
u_int8_t fwMajor
Definition: protocol.h:42
int njb_ping(njb_t *njb)
Definition: protocol.c:285
u_int16_t get_lsw(u_int32_t word)
Definition: byteorder.c:225
int njb_get_track_tag_header(njb_t *njb, njbttaghdr_t *tagh, int cmd)
Definition: protocol.c:407
int usb_setup(njb_t *njb, int type, int request, int value, int index, int length, void *data)
Definition: usb_io.c:190
u_int32_t njb1_bytes_to_32bit(unsigned char *dp)
Definition: byteorder.c:72
u_int64_t njb1_bytes_to_64bit(unsigned char *dp)
Definition: byteorder.c:27
void data_dump(FILE *f, void *buf, size_t n)
Definition: ioutil.c:35
#define EO_RDSHORT
Definition: njb_error.h:13
u_int32_t trid
Definition: libnjb.h:223
void from_32bit_to_njb1_bytes(u_int32_t val, unsigned char *dp)
Definition: byteorder.c:112
char productName[33]
Definition: protocol.h:41
int njb_get_disk_usage(njb_t *njb, u_int64_t *total, u_int64_t *free_bytes)
Definition: protocol.c:599
njb_datafile_t * datafile_unpack(unsigned char *data, size_t nbytes)
Definition: datafile.c:164
njb_songid_t * songid_unpack(void *data, size_t nbytes)
Definition: songid.c:68
int njb_get_playlist_header(njb_t *njb, njbplhdr_t *plh, int cmd)
Definition: protocol.c:500
Definition: protocol.h:16
njb_eax_t * njb_get_nexteax(njb_t *njb)
Definition: protocol.c:1267
u_int8_t sdmiid[16]
Definition: protocol.h:39
#define EO_WRSHORT
Definition: njb_error.h:20
Definition: protocol.h:21
ssize_t usb_pipe_read(njb_t *njb, void *buf, size_t nbytes)
Definition: usb_io.c:118
int njb_verify_last_command(njb_t *njb)
Definition: protocol.c:342
u_int16_t njb1_bytes_to_16bit(unsigned char *dp)
Definition: byteorder.c:146
u_int16_t get_msw(u_int32_t word)
Definition: byteorder.c:212
#define NJB_STATUS(a, b)
Definition: protocol.c:84
int eax_unpack(void *data, size_t nbytes, njb_state_t *state)
Definition: eax.c:66
int njb_get_datafile_header(njb_t *njb, njbdfhdr_t *dfh, int cmd)
Definition: protocol.c:709
int njb_set_library_counter(njb_t *njb, u_int64_t count)
Definition: protocol.c:207
njb_playlist_t * playlist_unpack(void *data, size_t nbytes)
Definition: playlist.c:56