00001
00057 #ifndef __NJB__PROTO3__H
00058 #define __NJB__PROTO3__H
00059
00060 #include "libnjb.h"
00061
00062
00063 #define NJB3_SHORTREAD_BUFSIZE 1024
00064
00065
00066 #define NJB3_CHUNK_SIZE 0x100000U
00067 #define NJB3_FIRMWARE_CHUNK_SIZE 0x40000U
00068 #define NJB3_DEFAULT_GET_FILE_BLOCK_SIZE 0x2000U
00069 #define NJB3_DEFAULT_SEND_FILE_BLOCK_SIZE 0x2000U
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 #define NJB3_CODECS_FRAME_ID 0x0001U
00081 #define NJB3_DISKUTIL_FRAME_ID 0x0002U
00082 #define NJB3_PRODID_FRAME_ID 0x0003U
00083
00084
00085
00086
00087
00088 #define NJB3_LOCKED_FRAME_ID 0x0006U
00089 #define NJB3_FNAME_FRAME_ID 0x0007U
00090 #define NJB3_UNKNOWN1_FRAME_ID 0x0008U
00091 #define NJB3_KEY_FRAME_ID 0x000aU
00092 #define NJB3_CODEC_FRAME_ID 0x000bU
00093 #define NJB3_POSTID_FRAME_ID 0x000cU
00094 #define NJB3_DIR_FRAME_ID 0x000dU
00095 #define NJB3_FILESIZE_FRAME_ID 0x000eU
00096
00097
00098
00099
00100
00101
00102 #define NJB3_FILECOUNT_FRAME_ID 0x0013U
00103 #define NJB3_VALUE_FRAME_ID 0x0014U
00104 #define NJB3_JUKEBOXID_FRAME_ID 0x0015U
00105 #define NJB3_FILETIME_FRAME_ID 0x0016U
00106 #define NJB3_UNKNOWN6_FRAME_ID 0x0017U
00107 #define NJB3_FILEFLAGS_FRAME_ID 0x0018U
00108
00109
00110
00111
00112 #define NJB3_ALBUM_FRAME_ID 0x0101U
00113 #define NJB3_ARTIST_FRAME_ID 0x0102U
00114 #define NJB3_GENRE_FRAME_ID 0x0103U
00115 #define NJB3_TITLE_FRAME_ID 0x0104U
00116 #define NJB3_LENGTH_FRAME_ID 0x0105U
00117 #define NJB3_TRACKNO_FRAME_ID 0x0106U
00118 #define NJB3_YEAR_FRAME_ID 0x0107U
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 #define NJB3_SMARTPAR_FRAME_ID 0x010aU
00129
00130
00131
00132
00133
00134
00135
00136
00137 #define NJB3_PLAYINFO_FRAME_ID 0x010bU
00138 #define NJB3_SEEKTRACK_FRAME_ID 0x010cU
00139 #define NJB3_EAX_TYPENAME 0x010eU
00140 #define NJB3_PLNAME_FRAME_ID 0x010fU
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 #define NJB3_TIME_FRAME_ID 0x0110U
00156 #define NJB3_ALBUMCNT_FRAME_ID 0x0111U
00157 #define NJB3_TRACKCNT_FRAME_ID 0x0112U
00158 #define NJB3_OWNER_FRAME_ID 0x0113U
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 #define NJB3_BATTERY_FRAME_ID 0x0114U
00169 #define NJB3_PLCNT_FRAME_ID 0x0115U
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 #define NJB3_PLAYTRACK_FRAME_ID 0x0119U
00182
00183
00184
00185
00186
00187 #define NJB3_UNKNOWN4_FRAME_ID 0x011aU
00188 #define NJB3_PLTRACKS_FRAME_ID 0x011cU
00189
00190
00191
00192
00193
00194
00195
00196
00197 #define NJB3_MINMAX_ID 0x0201U
00198 #define NJB3_EAX_ACTIVE_ID 0x0202U
00199
00200 #define NJB3_VOLUME_FRAME_ID 0x0203U
00201 #define NJB3_ENV_FRAME_ID 0x0204U
00202 #define NJB3_EQ_FRAME_ID 0x0205U
00203 #define NJB3_SPAT_FRAME_ID 0x0206U
00204 #define NJB3_TSCALE_FRAME_ID 0x0207U
00205 #define NJB3_SMARTVOL_FRAME_ID 0x0208U
00206 #define NJB3_EAXACTIVE_FRAME_ID 0x020aU
00207 #define NJB3_EAXID_FRAME_ID 0x020bU
00208 #define NJB3_EAX_INDEX_ID 0x020cU
00209 #define NJB3_KEYVALUE_FRAME_ID 0x1400U
00210
00211
00212
00213 #define NJB3_FILE_DATABASE 0x0000U
00214 #define NJB3__PLAYLIST_DATABASE 0x0001U
00215 #define NJB3_TRACK_DATABASE 0x0002U
00216
00217
00218 #define NJB3_CODEC_MP3_ID_OLD 0x0000U
00219 #define NJB3_CODEC_WAV_ID 0x0001U
00220 #define NJB3_CODEC_MP3_ID 0x0002U
00221 #define NJB3_CODEC_WMA_ID 0x0003U
00222
00223
00224
00225
00226
00227
00228 #define NJB3_CODEC_AA_ID 0x0007U
00229 #define NJB3_CODEC_PROTECTED_WMA_ID 0x0203U
00230
00231
00232 #define NJB3_START_PLAY 0x00
00233 #define NJB3_STOP_PLAY 0x01
00234 #define NJB3_PAUSE_PLAY 0x02
00235 #define NJB3_RESUME_PLAY 0x03
00236
00237
00238 #define NJB3_STATUS_OK 0x0000U
00239 #define NJB3_STATUS_EMPTY 0x0001U
00240 #define NJB3_STATUS_TRANSFER_ERROR 0x0002U
00241 #define NJB3_STATUS_BAD_FILESIZE 0x0003U
00242 #define NJB3_STATUS_NOTIMPLEMENTED 0x0004U
00243 #define NJB3_STATUS_NOTEXIST 0x0005U
00244 #define NJB3_STATUS_PROTECTED 0x000cU
00245 #define NJB3_STATUS_EMPTY_CHUNK 0x000eU
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 #define njb3_start_play(njb) njb3_ctrl_playing(njb, NJB3_START_PLAY)
00263 #define njb3_stop_play(njb) njb3_ctrl_playing(njb, NJB3_STOP_PLAY)
00264 #define njb3_pause_play(njb) njb3_ctrl_playing(njb, NJB3_PAUSE_PLAY)
00265 #define njb3_resume_play(njb) njb3_ctrl_playing(njb, NJB3_RESUME_PLAY)
00266
00267
00268 typedef struct {
00269
00270 int get_extended_tag_info;
00271 njb_songid_t *first_songid;
00272 njb_songid_t *next_songid;
00273 njb_playlist_t *first_plid;
00274 njb_playlist_t *next_plid;
00275 njb_datafile_t *first_dfid;
00276 njb_datafile_t *next_dfid;
00277 int current_playing_track;
00278 njb_keyval_t *first_key;
00279 njb_keyval_t *next_key;
00280 njb_eax_t *first_eax;
00281 njb_eax_t *next_eax;
00283 u_int8_t eax_processor_active;
00285 char *product_name;
00287 u_int8_t fwMajor;
00289 u_int8_t fwMinor;
00291 u_int8_t fwRel;
00293 u_int8_t hwMajor;
00295 u_int8_t hwMinor;
00297 u_int8_t hwRel;
00299 u_int16_t last_elapsed;
00301 u_int8_t turbo_mode;
00302 } njb3_state_t;
00303
00304
00305
00306
00307
00308
00309
00310
00311 int njb3_init_state (njb_t *njb);
00312 int njb3_set_bitmap(njb_t *njb, u_int16_t x_size, u_int16_t y_size, const unsigned char *bitmap);
00313 int njb3_current_track (njb_t *njb, u_int16_t * track);
00314 int njb3_elapsed_time (njb_t *njb, u_int16_t * elapsed, int * change);
00315 int njb3_play_track (njb_t *njb, u_int32_t trackid);
00316 int njb3_queue_track (njb_t *njb, u_int32_t trackid);
00317 int njb3_clear_play_queue(njb_t *njb);
00318 int njb3_ctrl_playing (njb_t *njb, int cmd);
00319 int njb3_seek_track (njb_t *njb, u_int32_t position);
00320 int njb3_get_codecs(njb_t *njb);
00321 int njb3_ping (njb_t *njb, int type);
00322 int njb3_power_status (njb_t *njb, int *battery_level, int *charging, int *ac_power);
00323 int njb3_readid (njb_t *njb, u_int8_t *sdmiid);
00324 int njb3_capture (njb_t *njb);
00325 int njb3_release (njb_t *njb);
00326 int njb3_get_disk_usage (njb_t *njb, u_int64_t *totalbytes, u_int64_t *freebytes);
00327 int njb3_turnoff_flashing(njb_t *njb);
00328 int njb3_get_owner_string (njb_t *njb, char *name);
00329 int njb3_set_owner_string (njb_t *njb, const char *name);
00330 njb_time_t *njb3_get_time(njb_t *njb);
00331 int njb3_set_time(njb_t *njb, njb_time_t *time);
00332 int njb3_reset_get_track_tag (njb_t *njb);
00333 njb_songid_t *njb3_get_next_track_tag (njb_t *njb);
00334 int njb3_reset_get_playlist_tag (njb_t *njb);
00335 njb_playlist_t *njb3_get_next_playlist_tag (njb_t *njb);
00336 int njb3_reset_get_datafile_tag (njb_t *njb);
00337 njb_datafile_t *njb3_get_next_datafile_tag (njb_t *njb);
00338 int njb3_read_keys(njb_t *njb);
00339 njb_keyval_t *njb3_get_keys(njb_t *njb);
00340 int njb3_request_file_chunk(njb_t *njb, u_int32_t fileid, u_int32_t offset);
00341 int njb3_get_file_block(njb_t *njb, unsigned char *data, u_int32_t maxsize);
00342 u_int32_t njb3_create_file(njb_t *njb, unsigned char *ptag, u_int32_t tagsize, u_int16_t database);
00343 u_int32_t njb3_send_file_chunk(njb_t *njb, unsigned char *chunk, u_int32_t chunksize, u_int32_t fileid);
00344 int njb3_send_file_complete(njb_t *njb, u_int32_t fileid);
00345 int njb3_create_folder(njb_t *njb, const char *name, u_int32_t *folderid);
00346 int njb3_delete_item(njb_t *njb, u_int32_t itemid);
00347 int njb3_update_16bit_frame(njb_t *njb, u_int32_t itemid, u_int16_t frameid, u_int16_t value);
00348 int njb3_update_string_frame(njb_t *njb, u_int32_t itemid, u_int16_t frameid, unsigned char *str);
00349 int njb3_update_tag(njb_t *njb, u_int32_t trackid, unsigned char *ptag, u_int32_t ptagsize);
00350 int njb3_create_playlist(njb_t *njb, char *name, u_int32_t *plid);
00351 int njb3_add_multiple_tracks_to_playlist (njb_t *njb, u_int32_t *plid, u_int32_t *trids, u_int16_t ntracks);
00352 int njb3_adjust_volume(njb_t *njb, u_int16_t value);
00353 int njb3_control_eax_processor (njb_t * njb, u_int16_t state);
00354 int njb3_adjust_eax(njb_t *njb, u_int16_t eaxid, u_int16_t patchindex, u_int16_t active, u_int16_t scalevalue);
00355 void njb3_read_eaxtypes(njb_t *njb);
00356 njb_eax_t *njb3_get_nexteax(njb_t *njb);
00357 int njb3_announce_firmware(njb_t *njb, u_int32_t size);
00358 u_int32_t njb3_send_firmware_chunk(njb_t *njb, u_int32_t chunksize, unsigned char *chunk);
00359 int njb3_get_firmware_confirmation(njb_t *njb);
00360 void njb3_destroy_state(njb_t *njb);
00361
00362 #endif