00001
00009 #ifndef __NJB__PROTO3__H
00010 #define __NJB__PROTO3__H
00011
00012 #include "libnjb.h"
00013
00014
00015 #define NJB3_SHORTREAD_BUFSIZE 1024
00016
00017
00018 #define NJB3_CHUNK_SIZE 0x100000U
00019 #define NJB3_FIRMWARE_CHUNK_SIZE 0x40000U
00020 #define NJB3_DEFAULT_GET_FILE_BLOCK_SIZE 0x2000U
00021 #define NJB3_DEFAULT_SEND_FILE_BLOCK_SIZE 0x2000U
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #define NJB3_CODECS_FRAME_ID 0x0001U
00055 #define NJB3_DISKUTIL_FRAME_ID 0x0002U
00056 #define NJB3_PRODID_FRAME_ID 0x0003U
00057
00058 #define NJB3_LOCKED_FRAME_ID 0x0006U
00059 #define NJB3_FNAME_FRAME_ID 0x0007U
00060 #define NJB3_UNKNOWN1_FRAME_ID 0x0008U
00061
00062 #define NJB3_KEY_FRAME_ID 0x000aU
00063 #define NJB3_CODEC_FRAME_ID 0x000bU
00064 #define NJB3_POSTID_FRAME_ID 0x000cU
00065 #define NJB3_DIR_FRAME_ID 0x000dU
00066 #define NJB3_FILESIZE_FRAME_ID 0x000eU
00067 #define NJB3_FILECOUNT_FRAME_ID 0x0013U
00068 #define NJB3_VALUE_FRAME_ID 0x0014U
00069 #define NJB3_JUKEBOXID_FRAME_ID 0x0015U
00070 #define NJB3_FILETIME_FRAME_ID 0x0016U
00071 #define NJB3_UNKNOWN6_FRAME_ID 0x0017U
00072 #define NJB3_FILEFLAGS_FRAME_ID 0x0018U
00073 #define NJB3_ALBUM_FRAME_ID 0x0101U
00074 #define NJB3_ARTIST_FRAME_ID 0x0102U
00075 #define NJB3_GENRE_FRAME_ID 0x0103U
00076 #define NJB3_TITLE_FRAME_ID 0x0104U
00077 #define NJB3_LENGTH_FRAME_ID 0x0105U
00078 #define NJB3_TRACKNO_FRAME_ID 0x0106U
00079 #define NJB3_YEAR_FRAME_ID 0x0107U
00080 #define NJB3_SMARTPAR_FRAME_ID 0x010aU
00081
00082
00083
00084
00085
00086
00087
00088
00089 #define NJB3_TRACKINFO_FRAME_ID 0x010bU
00090 #define NJB3_SEEKTRACK_FRAME_ID 0x010cU
00091 #define NJB3_EAX_TYPENAME 0x010eU
00092 #define NJB3_PLNAME_FRAME_ID 0x010fU
00093 #define NJB3_TIME_FRAME_ID 0x0110U
00094 #define NJB3_OWNER_FRAME_ID 0x0113U
00095 #define NJB3_BATTERY_FRAME_ID 0x0114U
00096 #define NJB3_UNKNOWN3_FRAME_ID 0x0115U
00097
00098 #define NJB3_PLAYTRACK_FRAME_ID 0x0119U
00099 #define NJB3_PLTRACKS_FRAME_ID 0x011cU
00100
00101
00102
00103
00104 #define NJB3_MINMAX_ID 0x0201U
00105 #define NJB3_EAX_ACTIVE_ID 0x0202U
00106
00107 #define NJB3_VOLUME_FRAME_ID 0x0203U
00108 #define NJB3_ENV_FRAME_ID 0x0204U
00109 #define NJB3_EQ_FRAME_ID 0x0205U
00110 #define NJB3_SPAT_FRAME_ID 0x0206U
00111 #define NJB3_TSCALE_FRAME_ID 0x0207U
00112 #define NJB3_SMARTVOL_FRAME_ID 0x0208U
00113 #define NJB3_EAXACTIVE_FRAME_ID 0x020aU
00114 #define NJB3_EAXID_FRAME_ID 0x020bU
00115 #define NJB3_EAX_INDEX_ID 0x020cU
00116 #define NJB3_KEYVALUE_FRAME_ID 0x1400U
00117
00118
00119
00120 #define NJB3_FILETYPE_FILE 0x0000U
00121 #define NJB3_FILETYPE_TRACK 0x0002U
00122
00123
00124 #define NJB3_CODEC_MP3_ID_OLD 0x0000U
00125 #define NJB3_CODEC_WAV_ID 0x0001U
00126 #define NJB3_CODEC_MP3_ID 0x0002U
00127 #define NJB3_CODEC_WMA_ID 0x0003U
00128
00129
00130
00131
00132
00133
00134 #define NJB3_CODEC_AA_ID 0x0007U
00135 #define NJB3_CODEC_PROTECTED_WMA_ID 0x0203U
00136
00137
00138 #define NJB3_START_PLAY 0x00
00139 #define NJB3_STOP_PLAY 0x01
00140 #define NJB3_PAUSE_PLAY 0x02
00141 #define NJB3_RESUME_PLAY 0x03
00142
00143
00144 #define NJB3_STATUS_OK 0x0000U
00145 #define NJB3_STATUS_EMPTY 0x0001U
00146 #define NJB3_STATUS_TRANSFER_ERROR 0x0002U
00147 #define NJB3_STATUS_BAD_FILESIZE 0x0003U
00148 #define NJB3_STATUS_NOTIMPLEMENTED 0x0004U
00149 #define NJB3_STATUS_NOTEXIST 0x0005U
00150 #define NJB3_STATUS_PROTECTED 0x000cU
00151 #define NJB3_STATUS_EMPTY_CHUNK 0x000eU
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 #define njb3_start_play(njb) njb3_ctrl_playing(njb, NJB3_START_PLAY)
00169 #define njb3_stop_play(njb) njb3_ctrl_playing(njb, NJB3_STOP_PLAY)
00170 #define njb3_pause_play(njb) njb3_ctrl_playing(njb, NJB3_PAUSE_PLAY)
00171 #define njb3_resume_play(njb) njb3_ctrl_playing(njb, NJB3_RESUME_PLAY)
00172
00173
00174 typedef struct {
00175
00176 int get_extended_tag_info;
00177 njb_songid_t *first_songid;
00178 njb_songid_t *next_songid;
00179 njb_playlist_t *first_plid;
00180 njb_playlist_t *next_plid;
00181 njb_datafile_t *first_dfid;
00182 njb_datafile_t *next_dfid;
00183 int current_playing_track;
00184 njb_keyval_t *first_key;
00185 njb_keyval_t *next_key;
00186 njb_eax_t *first_eax;
00187 njb_eax_t *next_eax;
00189 u_int8_t eax_processor_active;
00191 char *product_name;
00193 u_int8_t fwMajor;
00195 u_int8_t fwMinor;
00197 u_int8_t fwRel;
00199 u_int8_t hwMajor;
00201 u_int8_t hwMinor;
00203 u_int8_t hwRel;
00205 u_int16_t last_elapsed;
00207 u_int8_t turbo_mode;
00208 } njb3_state_t;
00209
00210
00211
00212 int njb3_init_state (njb_t *njb);
00213 int njb3_set_bitmap(njb_t *njb, u_int16_t x_size, u_int16_t y_size, const unsigned char *bitmap);
00214 int njb3_current_track (njb_t *njb, u_int16_t * track);
00215 int njb3_elapsed_time (njb_t *njb, u_int16_t * elapsed, int * change);
00216 int njb3_play_track (njb_t *njb, u_int32_t trackid);
00217 int njb3_queue_track (njb_t *njb, u_int32_t trackid);
00218 int njb3_ctrl_playing (njb_t *njb, int cmd);
00219 int njb3_seek_track (njb_t *njb, u_int32_t position);
00220 int njb3_get_codecs(njb_t *njb);
00221 int njb3_ping (njb_t *njb, int type);
00222 int njb3_power_status (njb_t *njb, int *battery_level, int *charging, int *ac_power);
00223 int njb3_readid (njb_t *njb, u_int8_t *sdmiid);
00224 int njb3_capture (njb_t *njb);
00225 int njb3_release (njb_t *njb);
00226 int njb3_get_disk_usage (njb_t *njb, u_int64_t *totalbytes, u_int64_t *freebytes);
00227 int njb3_get_owner_string (njb_t *njb, char *name);
00228 int njb3_set_owner_string (njb_t *njb, const char *name);
00229 njb_time_t *njb3_get_time(njb_t *njb);
00230 int njb3_set_time(njb_t *njb, njb_time_t *time);
00231 int njb3_reset_get_track_tag (njb_t *njb);
00232 njb_songid_t *njb3_get_next_track_tag (njb_t *njb);
00233 int njb3_reset_get_playlist_tag (njb_t *njb);
00234 njb_playlist_t *njb3_get_next_playlist_tag (njb_t *njb);
00235 int njb3_reset_get_datafile_tag (njb_t *njb);
00236 njb_datafile_t *njb3_get_next_datafile_tag (njb_t *njb);
00237 int njb3_read_keys(njb_t *njb);
00238 njb_keyval_t *njb3_get_keys(njb_t *njb);
00239 int njb3_request_file_chunk(njb_t *njb, u_int32_t fileid, u_int32_t offset);
00240 int njb3_get_file_block(njb_t *njb, unsigned char *data, u_int32_t maxsize);
00241 u_int32_t njb3_create_file(njb_t *njb, unsigned char *ptag, u_int32_t tagsize, u_int16_t filetype);
00242 u_int32_t njb3_send_file_chunk(njb_t *njb, unsigned char *chunk, u_int32_t chunksize, u_int32_t fileid);
00243 int njb3_send_file_complete(njb_t *njb, u_int32_t fileid);
00244 int njb3_create_folder(njb_t *njb, const char *name, u_int32_t *folderid);
00245 int njb3_delete_item(njb_t *njb, u_int32_t itemid);
00246 int njb3_update_16bit_frame(njb_t *njb, u_int32_t itemid, u_int16_t frameid, u_int16_t value);
00247 int njb3_update_string_frame(njb_t *njb, u_int32_t itemid, u_int16_t frameid, unsigned char *str);
00248 int njb3_update_tag(njb_t *njb, u_int32_t trackid, unsigned char *ptag, u_int32_t ptagsize);
00249 int njb3_create_playlist(njb_t *njb, char *name, u_int32_t *plid);
00250 int njb3_add_multiple_tracks_to_playlist (njb_t *njb, u_int32_t *plid, u_int32_t *trids, u_int16_t ntracks);
00251 int njb3_adjust_volume(njb_t *njb, u_int16_t value);
00252 int njb3_control_eax_processor (njb_t * njb, u_int16_t state);
00253 int njb3_adjust_eax(njb_t *njb, u_int16_t eaxid, u_int16_t patchindex, u_int16_t active, u_int16_t scalevalue);
00254 void njb3_read_eaxtypes(njb_t *njb);
00255 njb_eax_t *njb3_get_nexteax(njb_t *njb);
00256 int njb3_announce_firmware(njb_t *njb, u_int32_t size);
00257 u_int32_t njb3_send_firmware_chunk(njb_t *njb, u_int32_t chunksize, unsigned char *chunk);
00258 int njb3_get_firmware_confirmation(njb_t *njb);
00259 void njb3_destroy_state(njb_t *njb);
00260
00261 #endif