Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 191a8a9815631149211a94f0cdc8f64d > files > 115

libnjb-devel-2.2.7-1.fc14.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libnjb: /builddir/build/BUILD/libnjb-2.2.7/src/protocol3.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">libnjb&#160;<span id="projectnumber">2.2.7</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="dir_55a6aa4feb4da29582c8781b5e808e47.html">src</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">protocol3.h</div>  </div>
</div>
<div class="contents">
<a href="protocol3_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00057"></a>00057 <span class="preprocessor">#ifndef __NJB__PROTO3__H</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">#define __NJB__PROTO3__H</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span>
<a name="l00060"></a>00060 <span class="preprocessor">#include &quot;<a class="code" href="libnjb_8h.html">libnjb.h</a>&quot;</span>
<a name="l00061"></a>00061 
<a name="l00062"></a>00062 <span class="comment">/* Buffer for short reads */</span>
<a name="l00063"></a>00063 <span class="preprocessor">#define NJB3_SHORTREAD_BUFSIZE 1024</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span>
<a name="l00065"></a>00065 <span class="comment">/* Transfer block size (adding and fetching tracks, files */</span>
<a name="l00066"></a>00066 <span class="preprocessor">#define NJB3_CHUNK_SIZE 0x100000U</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_FIRMWARE_CHUNK_SIZE 0x40000U</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_DEFAULT_GET_FILE_BLOCK_SIZE    0x2000U</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_DEFAULT_SEND_FILE_BLOCK_SIZE   0x2000U</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span>
<a name="l00071"></a>00071 <span class="comment">/*</span>
<a name="l00072"></a>00072 <span class="comment"> * These are the frame IDs used by the series 3 devices.</span>
<a name="l00073"></a>00073 <span class="comment"> * The frames are used for all the commands listed above, so</span>
<a name="l00074"></a>00074 <span class="comment"> * the same number series will contain very different things</span>
<a name="l00075"></a>00075 <span class="comment"> * like different kind of device properties and parameters</span>
<a name="l00076"></a>00076 <span class="comment"> * (e.g. disk utilization) and metadata tag elements (e.g.</span>
<a name="l00077"></a>00077 <span class="comment"> * &quot;artist field&quot;). The only way to see what a frame actually</span>
<a name="l00078"></a>00078 <span class="comment"> * represents is to see how it is used.</span>
<a name="l00079"></a>00079 <span class="comment"> */</span>
<a name="l00080"></a>00080 <span class="preprocessor">#define NJB3_CODECS_FRAME_ID    0x0001U </span><span class="comment">/* 16 bit array R: List of supported audio file types/codecs */</span>
<a name="l00081"></a>00081 <span class="preprocessor">#define NJB3_DISKUTIL_FRAME_ID  0x0002U </span><span class="comment">/* 14 bytes R: disk utilization information */</span>
<a name="l00082"></a>00082 <span class="preprocessor">#define NJB3_PRODID_FRAME_ID    0x0003U </span><span class="comment">/* 3 bytes FW rev 3 bytes HW rev, string product ID */</span>
<a name="l00083"></a>00083 <span class="comment">/* </span>
<a name="l00084"></a>00084 <span class="comment"> * 0x0004 and 0x0005 return NULL when read as device </span>
<a name="l00085"></a>00085 <span class="comment"> * parameters, are probably used as some kind of </span>
<a name="l00086"></a>00086 <span class="comment"> * metadata frames. </span>
<a name="l00087"></a>00087 <span class="comment"> */</span>
<a name="l00088"></a>00088 <span class="preprocessor">#define NJB3_LOCKED_FRAME_ID    0x0006U </span><span class="comment">/* 16 bit word */</span>
<a name="l00089"></a>00089 <span class="preprocessor">#define NJB3_FNAME_FRAME_ID     0x0007U </span><span class="comment">/* String: Original filename on host */</span>
<a name="l00090"></a>00090 <span class="preprocessor">#define NJB3_UNKNOWN1_FRAME_ID  0x0008U </span><span class="comment">/* 16 bit word, value 0x0004 on NJB Zen USB 2.0, not read by Win SW */</span>
<a name="l00091"></a>00091 <span class="preprocessor">#define NJB3_KEY_FRAME_ID       0x000aU </span><span class="comment">/* 4 bytes string &quot;AR00&quot;, &quot;PL00&quot;, &quot;SG00&quot;, &quot;LG00&quot; known */</span>
<a name="l00092"></a>00092 <span class="preprocessor">#define NJB3_CODEC_FRAME_ID     0x000bU </span><span class="comment">/* 16 bit word */</span>
<a name="l00093"></a>00093 <span class="preprocessor">#define NJB3_POSTID_FRAME_ID    0x000cU </span><span class="comment">/* 16 bit word TrackID on tracks, PlaylistID on playlists */</span>
<a name="l00094"></a>00094 <span class="preprocessor">#define NJB3_DIR_FRAME_ID       0x000dU </span><span class="comment">/* String: Original directory on host */</span>
<a name="l00095"></a>00095 <span class="preprocessor">#define NJB3_FILESIZE_FRAME_ID  0x000eU </span><span class="comment">/* 32 bit word */</span>
<a name="l00096"></a>00096 <span class="comment">/*</span>
<a name="l00097"></a>00097 <span class="comment"> * 0x0010 and 0x0011 return a 16-bit value of 0x0002 </span>
<a name="l00098"></a>00098 <span class="comment"> * respective 0x0200 when read as device parameters.</span>
<a name="l00099"></a>00099 <span class="comment"> * e.g. 0000 0004 0011 0200 0000</span>
<a name="l00100"></a>00100 <span class="comment"> * 0x0011 may be sector size or USB xfer block size...</span>
<a name="l00101"></a>00101 <span class="comment"> */</span>
<a name="l00102"></a>00102 <span class="preprocessor">#define NJB3_FILECOUNT_FRAME_ID 0x0013U </span><span class="comment">/* 32 bit word R: file &amp; directory count */</span>
<a name="l00103"></a>00103 <span class="preprocessor">#define NJB3_VALUE_FRAME_ID     0x0014U </span><span class="comment">/* 8 bytes, 2*32 bit words */</span>
<a name="l00104"></a>00104 <span class="preprocessor">#define NJB3_JUKEBOXID_FRAME_ID 0x0015U </span><span class="comment">/* 16 bytes R: unique device ID */</span>
<a name="l00105"></a>00105 <span class="preprocessor">#define NJB3_FILETIME_FRAME_ID  0x0016U </span><span class="comment">/* 32 bit word - timestamp (UNIX format) */</span>
<a name="l00106"></a>00106 <span class="preprocessor">#define NJB3_UNKNOWN6_FRAME_ID  0x0017U </span><span class="comment">/* 32 bit word - could be FAT32 attributes */</span>
<a name="l00107"></a>00107 <span class="preprocessor">#define NJB3_FILEFLAGS_FRAME_ID 0x0018U </span><span class="comment">/* 32 bit word set on files and folders - NTFS file attributes */</span>
<a name="l00108"></a>00108 <span class="comment">/*</span>
<a name="l00109"></a>00109 <span class="comment"> * 0x0100 is some kind of 6-byte device parameter, value</span>
<a name="l00110"></a>00110 <span class="comment"> * from NJB Zen USB 2.0: 0001 0000 03ff</span>
<a name="l00111"></a>00111 <span class="comment"> */</span>
<a name="l00112"></a>00112 <span class="preprocessor">#define NJB3_ALBUM_FRAME_ID     0x0101U </span><span class="comment">/* String */</span>
<a name="l00113"></a>00113 <span class="preprocessor">#define NJB3_ARTIST_FRAME_ID    0x0102U </span><span class="comment">/* String */</span>
<a name="l00114"></a>00114 <span class="preprocessor">#define NJB3_GENRE_FRAME_ID     0x0103U </span><span class="comment">/* String */</span>
<a name="l00115"></a>00115 <span class="preprocessor">#define NJB3_TITLE_FRAME_ID     0x0104U </span><span class="comment">/* String */</span>
<a name="l00116"></a>00116 <span class="preprocessor">#define NJB3_LENGTH_FRAME_ID    0x0105U </span><span class="comment">/* String */</span>
<a name="l00117"></a>00117 <span class="preprocessor">#define NJB3_TRACKNO_FRAME_ID   0x0106U </span><span class="comment">/* 16 bit word */</span>
<a name="l00118"></a>00118 <span class="preprocessor">#define NJB3_YEAR_FRAME_ID      0x0107U </span><span class="comment">/* 16 bit word */</span>
<a name="l00119"></a>00119 <span class="comment">/*</span>
<a name="l00120"></a>00120 <span class="comment"> * Smartvolume parameters for a track is sent after a track with the command:</span>
<a name="l00121"></a>00121 <span class="comment"> * 0x0001 0x0001 update file with info</span>
<a name="l00122"></a>00122 <span class="comment"> * 0x0000 0x0000 4 bytes trackid</span>
<a name="l00123"></a>00123 <span class="comment"> * 0x01b6 (length)</span>
<a name="l00124"></a>00124 <span class="comment"> * 0x010a (smartvol)</span>
<a name="l00125"></a>00125 <span class="comment"> * 0x01b6 unknown bytes, appears to be an array of 109 32-bit words.</span>
<a name="l00126"></a>00126 <span class="comment"> * 0x0000 terminator</span>
<a name="l00127"></a>00127 <span class="comment"> */</span>
<a name="l00128"></a>00128 <span class="preprocessor">#define NJB3_SMARTPAR_FRAME_ID  0x010aU</span>
<a name="l00129"></a>00129 <span class="preprocessor"></span><span class="comment">/*</span>
<a name="l00130"></a>00130 <span class="comment"> * 16 bit word R/W: Info about current track playing on the device </span>
<a name="l00131"></a>00131 <span class="comment"> * First byte appear to always be 0x0b, second means the following:</span>
<a name="l00132"></a>00132 <span class="comment"> * 0x00 = play/playing</span>
<a name="l00133"></a>00133 <span class="comment"> * 0x01 = stop/stopped</span>
<a name="l00134"></a>00134 <span class="comment"> * 0x02 = pause/paused</span>
<a name="l00135"></a>00135 <span class="comment"> * 0x03 = resume (write only)</span>
<a name="l00136"></a>00136 <span class="comment"> */</span>
<a name="l00137"></a>00137 <span class="preprocessor">#define NJB3_PLAYINFO_FRAME_ID  0x010bU</span>
<a name="l00138"></a>00138 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_SEEKTRACK_FRAME_ID 0x010cU </span><span class="comment">/* 32 bit word W: seek to position (in ms) in current track */</span>
<a name="l00139"></a>00139 <span class="preprocessor">#define NJB3_EAX_TYPENAME       0x010eU </span><span class="comment">/* String with the name of an EAX type */</span>
<a name="l00140"></a>00140 <span class="preprocessor">#define NJB3_PLNAME_FRAME_ID    0x010fU </span><span class="comment">/* String: playlist name */</span>
<a name="l00141"></a>00141 <span class="comment">/*</span>
<a name="l00142"></a>00142 <span class="comment"> * 8 bytes R/W, BCD-encoded time and date:</span>
<a name="l00143"></a>00143 <span class="comment"> * byte: meaning:</span>
<a name="l00144"></a>00144 <span class="comment"> * 00: day of the week (0 = sunday)</span>
<a name="l00145"></a>00145 <span class="comment"> * 01: day of the month (1-31)</span>
<a name="l00146"></a>00146 <span class="comment"> * 02: month of the year (1-12)</span>
<a name="l00147"></a>00147 <span class="comment"> * 03: year century digit (20 mostly...)</span>
<a name="l00148"></a>00148 <span class="comment"> * 04: year lower part</span>
<a name="l00149"></a>00149 <span class="comment"> * 05: hours</span>
<a name="l00150"></a>00150 <span class="comment"> * 06: minutes</span>
<a name="l00151"></a>00151 <span class="comment"> * 07: seconds</span>
<a name="l00152"></a>00152 <span class="comment"> * e.g.: 0619 1120 0518 4351,</span>
<a name="l00153"></a>00153 <span class="comment"> * means saturday, 2005-11-19, 18:43:51</span>
<a name="l00154"></a>00154 <span class="comment"> */</span>
<a name="l00155"></a>00155 <span class="preprocessor">#define NJB3_TIME_FRAME_ID      0x0110U</span>
<a name="l00156"></a>00156 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_ALBUMCNT_FRAME_ID  0x0111U </span><span class="comment">/* 32 bit word R: number of albums on device */</span>
<a name="l00157"></a>00157 <span class="preprocessor">#define NJB3_TRACKCNT_FRAME_ID  0x0112U </span><span class="comment">/* 32 bit word R: number of tracks on device */</span>
<a name="l00158"></a>00158 <span class="preprocessor">#define NJB3_OWNER_FRAME_ID     0x0113U </span><span class="comment">/* String: owner name */</span>
<a name="l00159"></a>00159 <span class="comment">/*</span>
<a name="l00160"></a>00160 <span class="comment"> * 4 bytes: 0x14, one byte charging status then 16 bits of battery level </span>
<a name="l00161"></a>00161 <span class="comment"> * The first byte appear to always contain 0x14.</span>
<a name="l00162"></a>00162 <span class="comment"> * The second value is interpreted as follows:</span>
<a name="l00163"></a>00163 <span class="comment"> * 0x00 = power connected and charging</span>
<a name="l00164"></a>00164 <span class="comment"> * 0x01 = power connected, battery fully charged</span>
<a name="l00165"></a>00165 <span class="comment"> * 0x02 = power disconnected</span>
<a name="l00166"></a>00166 <span class="comment"> * Then follows the battery level as a 16bit value.</span>
<a name="l00167"></a>00167 <span class="comment"> */</span>
<a name="l00168"></a>00168 <span class="preprocessor">#define NJB3_BATTERY_FRAME_ID   0x0114U</span>
<a name="l00169"></a>00169 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_PLCNT_FRAME_ID     0x0115U </span><span class="comment">/* 32 bit word: number of playlists on device */</span>
<a name="l00170"></a>00170 <span class="comment">/*</span>
<a name="l00171"></a>00171 <span class="comment"> * 0x0116-0x0118 can be read as device registers.</span>
<a name="l00172"></a>00172 <span class="comment"> * they will return one 32 bit word each, this is</span>
<a name="l00173"></a>00173 <span class="comment"> * what it looks like on NJB Zen USB 2.0 in rest</span>
<a name="l00174"></a>00174 <span class="comment"> * mode:</span>
<a name="l00175"></a>00175 <span class="comment"> *</span>
<a name="l00176"></a>00176 <span class="comment"> * 0x0116: 00000000</span>
<a name="l00177"></a>00177 <span class="comment"> * 0x0117: 00000000</span>
<a name="l00178"></a>00178 <span class="comment"> * 0x0118: ffffffff</span>
<a name="l00179"></a>00179 <span class="comment"> * </span>
<a name="l00180"></a>00180 <span class="comment"> */</span>
<a name="l00181"></a>00181 <span class="preprocessor">#define NJB3_PLAYTRACK_FRAME_ID 0x0119U </span><span class="comment">/* 32 bit word track ID to play */</span>
<a name="l00182"></a>00182 <span class="comment">/*</span>
<a name="l00183"></a>00183 <span class="comment"> * Seen after clearing the playback queue in this sequence:</span>
<a name="l00184"></a>00184 <span class="comment"> * 0007 0001 0004 011a 1a00 0000 reading it out gives the </span>
<a name="l00185"></a>00185 <span class="comment"> * same value so probably the writing of it is useless.</span>
<a name="l00186"></a>00186 <span class="comment"> */</span>
<a name="l00187"></a>00187 <span class="preprocessor">#define NJB3_UNKNOWN4_FRAME_ID  0x011aU</span>
<a name="l00188"></a>00188 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_PLTRACKS_FRAME_ID  0x011cU </span><span class="comment">/* Array of 16bit words */</span>
<a name="l00189"></a>00189 <span class="comment">/*</span>
<a name="l00190"></a>00190 <span class="comment"> * 0x011d - 0x0120 return sensible, static but undeciphered values</span>
<a name="l00191"></a>00191 <span class="comment"> * when read out as device registers. Sample values from NJB Zen USB 2.0:</span>
<a name="l00192"></a>00192 <span class="comment"> * 0x011d: 00000407</span>
<a name="l00193"></a>00193 <span class="comment"> * 0x011e: 00000070</span>
<a name="l00194"></a>00194 <span class="comment"> * 0x011f: 1f00 1f01 1f02 1f03</span>
<a name="l00195"></a>00195 <span class="comment"> * 0x0120: 0001 fffe 0011</span>
<a name="l00196"></a>00196 <span class="comment"> */</span>
<a name="l00197"></a>00197 <span class="preprocessor">#define NJB3_MINMAX_ID          0x0201U </span><span class="comment">/* 2x16 bit values, max and min */</span>
<a name="l00198"></a>00198 <span class="preprocessor">#define NJB3_EAX_ACTIVE_ID      0x0202U </span><span class="comment">/* 16 bit word - this EAX type is active/to </span>
<a name="l00199"></a>00199 <span class="comment">                                         * be activated (0x0000 = off, 0x0001 = on) */</span>
<a name="l00200"></a>00200 <span class="preprocessor">#define NJB3_VOLUME_FRAME_ID    0x0203U </span><span class="comment">/* 16 bit word */</span>
<a name="l00201"></a>00201 <span class="preprocessor">#define NJB3_ENV_FRAME_ID       0x0204U </span><span class="comment">/* 16 bit word - environment setting */</span>
<a name="l00202"></a>00202 <span class="preprocessor">#define NJB3_EQ_FRAME_ID        0x0205U </span><span class="comment">/* 16 bit word - equalizer setting */</span>
<a name="l00203"></a>00203 <span class="preprocessor">#define NJB3_SPAT_FRAME_ID      0x0206U </span><span class="comment">/* 16 bit word - spatialization 2 = full */</span>
<a name="l00204"></a>00204 <span class="preprocessor">#define NJB3_TSCALE_FRAME_ID    0x0207U </span><span class="comment">/* 16 bit word - time scaling factor */</span>
<a name="l00205"></a>00205 <span class="preprocessor">#define NJB3_SMARTVOL_FRAME_ID  0x0208U </span><span class="comment">/* 16 bit word - smart volume setting */</span>
<a name="l00206"></a>00206 <span class="preprocessor">#define NJB3_EAXACTIVE_FRAME_ID 0x020aU </span><span class="comment">/* 16 bit word - 0x0000/0x0001 = activate/deactivate EAX processor */</span>
<a name="l00207"></a>00207 <span class="preprocessor">#define NJB3_EAXID_FRAME_ID     0x020bU </span><span class="comment">/* 16 bit word with the numerical ID of a certain EAX type */</span>
<a name="l00208"></a>00208 <span class="preprocessor">#define NJB3_EAX_INDEX_ID       0x020cU </span><span class="comment">/* 16 bit word - currently selected effect in a set of effects */</span>
<a name="l00209"></a>00209 <span class="preprocessor">#define NJB3_KEYVALUE_FRAME_ID  0x1400U </span><span class="comment">/* Array of value-key-pairs, requested in a </span>
<a name="l00210"></a>00210 <span class="comment">                                          subrequest parameter to this request */</span>
<a name="l00211"></a>00211 
<a name="l00212"></a>00212 <span class="comment">/* Database IDs, used for eg create_file */</span>
<a name="l00213"></a>00213 <span class="preprocessor">#define NJB3_FILE_DATABASE       0x0000U</span>
<a name="l00214"></a>00214 <span class="preprocessor"></span><span class="preprocessor">#define NJB3__PLAYLIST_DATABASE  0x0001U</span>
<a name="l00215"></a>00215 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_TRACK_DATABASE      0x0002U</span>
<a name="l00216"></a>00216 <span class="preprocessor"></span>
<a name="l00217"></a>00217 <span class="comment">/* Codec IDs */</span>
<a name="l00218"></a>00218 <span class="preprocessor">#define NJB3_CODEC_MP3_ID_OLD        0x0000U </span><span class="comment">/* Used on NJB3/Zen FW? */</span>
<a name="l00219"></a>00219 <span class="preprocessor">#define NJB3_CODEC_WAV_ID            0x0001U</span>
<a name="l00220"></a>00220 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_CODEC_MP3_ID            0x0002U</span>
<a name="l00221"></a>00221 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_CODEC_WMA_ID            0x0003U</span>
<a name="l00222"></a>00222 <span class="preprocessor"></span><span class="comment">/* </span>
<a name="l00223"></a>00223 <span class="comment"> * 0x0004, 0x0005 and 0x0006 unknown, one of them is </span>
<a name="l00224"></a>00224 <span class="comment"> * undoubtedly the Real Networks AAC + Helix DRM </span>
<a name="l00225"></a>00225 <span class="comment"> * decoder. Only very certain firmwares will support</span>
<a name="l00226"></a>00226 <span class="comment"> * these I believe...</span>
<a name="l00227"></a>00227 <span class="comment"> */</span>
<a name="l00228"></a>00228 <span class="preprocessor">#define NJB3_CODEC_AA_ID             0x0007U </span><span class="comment">/* Audible.com codec */</span>
<a name="l00229"></a>00229 <span class="preprocessor">#define NJB3_CODEC_PROTECTED_WMA_ID  0x0203U </span><span class="comment">/* Is it two bytes actually? */</span>
<a name="l00230"></a>00230 
<a name="l00231"></a>00231 <span class="comment">/* Stop, pause and resume are very much alike. */</span>
<a name="l00232"></a>00232 <span class="preprocessor">#define NJB3_START_PLAY     0x00</span>
<a name="l00233"></a>00233 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_STOP_PLAY      0x01</span>
<a name="l00234"></a>00234 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_PAUSE_PLAY     0x02</span>
<a name="l00235"></a>00235 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_RESUME_PLAY    0x03</span>
<a name="l00236"></a>00236 <span class="preprocessor"></span>
<a name="l00237"></a>00237 <span class="comment">/* Status codes */</span>
<a name="l00238"></a>00238 <span class="preprocessor">#define NJB3_STATUS_OK                0x0000U</span>
<a name="l00239"></a>00239 <span class="preprocessor"></span><span class="preprocessor">#define NJB3_STATUS_EMPTY             0x0001U </span><span class="comment">/* You tried to retrieve an empty item */</span>
<a name="l00240"></a>00240 <span class="preprocessor">#define NJB3_STATUS_TRANSFER_ERROR    0x0002U </span><span class="comment">/* Error during read or write */</span>
<a name="l00241"></a>00241 <span class="preprocessor">#define NJB3_STATUS_BAD_FILESIZE      0x0003U </span><span class="comment">/* Illegal file size (e.g. negative, too large) */</span>
<a name="l00242"></a>00242 <span class="preprocessor">#define NJB3_STATUS_NOTIMPLEMENTED    0x0004U </span><span class="comment">/* For example if EAX is not supported on a device */</span>
<a name="l00243"></a>00243 <span class="preprocessor">#define NJB3_STATUS_NOTEXIST          0x0005U </span><span class="comment">/* Tried to access nonexistant track */</span>
<a name="l00244"></a>00244 <span class="preprocessor">#define NJB3_STATUS_PROTECTED         0x000cU </span><span class="comment">/* Tried to access protected object */</span>
<a name="l00245"></a>00245 <span class="preprocessor">#define NJB3_STATUS_EMPTY_CHUNK       0x000eU </span><span class="comment">/* Appear when requesting empty metadata lists</span>
<a name="l00246"></a>00246 <span class="comment">                                               * or beyond the end of files. */</span>
<a name="l00247"></a>00247 
<a name="l00248"></a>00248 <span class="comment">/*</span>
<a name="l00249"></a>00249 <span class="comment"> * Status codes that must exist, find by trial-and-error:</span>
<a name="l00250"></a>00250 <span class="comment"> * - postid invalid (does not exist)</span>
<a name="l00251"></a>00251 <span class="comment"> * - disk full</span>
<a name="l00252"></a>00252 <span class="comment"> * - file path / track name etc too long </span>
<a name="l00253"></a>00253 <span class="comment"> * - playing (cannot transfer when playing)</span>
<a name="l00254"></a>00254 <span class="comment"> * - tried to skip to position outside file in playback mode</span>
<a name="l00255"></a>00255 <span class="comment"> * - too many files/tracks etc - limit reached.</span>
<a name="l00256"></a>00256 <span class="comment"> * - filename or track+artist+(all metadata) is the same as</span>
<a name="l00257"></a>00257 <span class="comment"> *   one already present on the player</span>
<a name="l00258"></a>00258 <span class="comment"> * - transfer in progress (a track/file is transferring in</span>
<a name="l00259"></a>00259 <span class="comment"> *   either direction</span>
<a name="l00260"></a>00260 <span class="comment"> */</span>
<a name="l00261"></a>00261 
<a name="l00262"></a>00262 <span class="preprocessor">#define njb3_start_play(njb) njb3_ctrl_playing(njb, NJB3_START_PLAY)</span>
<a name="l00263"></a>00263 <span class="preprocessor"></span><span class="preprocessor">#define njb3_stop_play(njb) njb3_ctrl_playing(njb, NJB3_STOP_PLAY)</span>
<a name="l00264"></a>00264 <span class="preprocessor"></span><span class="preprocessor">#define njb3_pause_play(njb) njb3_ctrl_playing(njb, NJB3_PAUSE_PLAY)</span>
<a name="l00265"></a>00265 <span class="preprocessor"></span><span class="preprocessor">#define njb3_resume_play(njb) njb3_ctrl_playing(njb, NJB3_RESUME_PLAY)</span>
<a name="l00266"></a>00266 <span class="preprocessor"></span>
<a name="l00267"></a>00267 <span class="comment">/* Structure to hold protocol3 states */</span>
<a name="l00268"></a><a class="code" href="structnjb3__state__t.html">00268</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00269"></a>00269   <span class="comment">/* Get extended tags */</span>
<a name="l00270"></a>00270   <span class="keywordtype">int</span> get_extended_tag_info;
<a name="l00271"></a>00271   <a class="code" href="structnjb__songid__struct.html">njb_songid_t</a> *first_songid;
<a name="l00272"></a>00272   <a class="code" href="structnjb__songid__struct.html">njb_songid_t</a> *next_songid;
<a name="l00273"></a>00273   <a class="code" href="structnjb__playlist__struct.html">njb_playlist_t</a> *first_plid;
<a name="l00274"></a>00274   <a class="code" href="structnjb__playlist__struct.html">njb_playlist_t</a> *next_plid;
<a name="l00275"></a>00275   <a class="code" href="structnjb__datafile__struct.html">njb_datafile_t</a> *first_dfid;
<a name="l00276"></a>00276   <a class="code" href="structnjb__datafile__struct.html">njb_datafile_t</a> *next_dfid;
<a name="l00277"></a>00277   <span class="keywordtype">int</span> current_playing_track;
<a name="l00278"></a>00278   <a class="code" href="structnjb__keyval__struct.html">njb_keyval_t</a> *first_key;
<a name="l00279"></a>00279   <a class="code" href="structnjb__keyval__struct.html">njb_keyval_t</a> *next_key;
<a name="l00280"></a>00280   <a class="code" href="structnjb__eax__struct.html">njb_eax_t</a> *first_eax;
<a name="l00281"></a>00281   <a class="code" href="structnjb__eax__struct.html">njb_eax_t</a> *next_eax;
<a name="l00283"></a><a class="code" href="structnjb3__state__t.html#a662a0c02b8ad844581597b4c2fac0231">00283</a>   u_int8_t <a class="code" href="structnjb3__state__t.html#a662a0c02b8ad844581597b4c2fac0231">eax_processor_active</a>;
<a name="l00285"></a><a class="code" href="structnjb3__state__t.html#a0344b9c490856a3f76cd4aa859e0375f">00285</a>   <span class="keywordtype">char</span> *<a class="code" href="structnjb3__state__t.html#a0344b9c490856a3f76cd4aa859e0375f">product_name</a>;
<a name="l00287"></a><a class="code" href="structnjb3__state__t.html#ae68cb8235ab1d125bd5c47d4bb3c02b4">00287</a>   u_int8_t <a class="code" href="structnjb3__state__t.html#ae68cb8235ab1d125bd5c47d4bb3c02b4">fwMajor</a>;
<a name="l00289"></a><a class="code" href="structnjb3__state__t.html#ac7ac5bf4b8514b0c198a6cc272a3e34e">00289</a>   u_int8_t <a class="code" href="structnjb3__state__t.html#ac7ac5bf4b8514b0c198a6cc272a3e34e">fwMinor</a>;
<a name="l00291"></a><a class="code" href="structnjb3__state__t.html#ac3aaedbd330c61123f71d84c09f70c3e">00291</a>   u_int8_t <a class="code" href="structnjb3__state__t.html#ac3aaedbd330c61123f71d84c09f70c3e">fwRel</a>;
<a name="l00293"></a><a class="code" href="structnjb3__state__t.html#a60e1db701cc6f1a3e6e6acbfb86ab26b">00293</a>   u_int8_t <a class="code" href="structnjb3__state__t.html#a60e1db701cc6f1a3e6e6acbfb86ab26b">hwMajor</a>;
<a name="l00295"></a><a class="code" href="structnjb3__state__t.html#a6492b0af17edf2b3f840c40d54df222c">00295</a>   u_int8_t <a class="code" href="structnjb3__state__t.html#a6492b0af17edf2b3f840c40d54df222c">hwMinor</a>;
<a name="l00297"></a><a class="code" href="structnjb3__state__t.html#a861f0b8e9ff6cf19008fc0f21ba27b3a">00297</a>   u_int8_t <a class="code" href="structnjb3__state__t.html#a861f0b8e9ff6cf19008fc0f21ba27b3a">hwRel</a>;
<a name="l00299"></a><a class="code" href="structnjb3__state__t.html#a1b131e81100aebfd03057d97d466c032">00299</a>   u_int16_t <a class="code" href="structnjb3__state__t.html#a1b131e81100aebfd03057d97d466c032">last_elapsed</a>;
<a name="l00301"></a><a class="code" href="structnjb3__state__t.html#a86ba6395f4d2a8f171cc6251ace4b9e1">00301</a>   u_int8_t <a class="code" href="structnjb3__state__t.html#a86ba6395f4d2a8f171cc6251ace4b9e1">turbo_mode</a>;
<a name="l00302"></a>00302 } <a class="code" href="structnjb3__state__t.html">njb3_state_t</a>;
<a name="l00303"></a>00303 
<a name="l00304"></a>00304 
<a name="l00305"></a>00305 <span class="comment">/* </span>
<a name="l00306"></a>00306 <span class="comment"> * NJB3 functions: the commands listed at the top of this</span>
<a name="l00307"></a>00307 <span class="comment"> * file are wrapped in binary form more or less using the defined</span>
<a name="l00308"></a>00308 <span class="comment"> * values in this file to conjure and decipher byte-sequences</span>
<a name="l00309"></a>00309 <span class="comment"> * sent by the devices.</span>
<a name="l00310"></a>00310 <span class="comment"> */</span>
<a name="l00311"></a>00311 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a62e227f18d3a17362052f14a81031035">njb3_init_state</a> (<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00312"></a>00312 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a22acc85e6102a1192c59c481d20b07aa">njb3_set_bitmap</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int16_t x_size, u_int16_t y_size, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *bitmap);
<a name="l00313"></a>00313 <span class="keywordtype">int</span> njb3_current_track (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int16_t * track);
<a name="l00314"></a>00314 <span class="keywordtype">int</span> njb3_elapsed_time (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int16_t * elapsed, <span class="keywordtype">int</span> * change);
<a name="l00315"></a>00315 <span class="keywordtype">int</span> njb3_play_track (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t trackid);
<a name="l00316"></a>00316 <span class="keywordtype">int</span> njb3_queue_track (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t trackid);
<a name="l00317"></a>00317 <span class="keywordtype">int</span> njb3_clear_play_queue(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00318"></a>00318 <span class="keywordtype">int</span> njb3_ctrl_playing (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keywordtype">int</span> cmd);
<a name="l00319"></a>00319 <span class="keywordtype">int</span> njb3_seek_track (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t position);
<a name="l00320"></a>00320 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a11ff9d3e1e3a638168f290e68f6a8a20">njb3_get_codecs</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00321"></a>00321 <span class="keywordtype">int</span> njb3_ping (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keywordtype">int</span> type);
<a name="l00322"></a>00322 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a01ddb94dde9f1369519cea9159947291">njb3_power_status</a> (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keywordtype">int</span> *battery_level, <span class="keywordtype">int</span> *charging, <span class="keywordtype">int</span> *ac_power);
<a name="l00323"></a>00323 <span class="keywordtype">int</span> njb3_readid (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int8_t *sdmiid);
<a name="l00324"></a>00324 <span class="keywordtype">int</span> njb3_capture (<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00325"></a>00325 <span class="keywordtype">int</span> njb3_release (<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00326"></a>00326 <span class="keywordtype">int</span> njb3_get_disk_usage (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int64_t *totalbytes, u_int64_t *freebytes);
<a name="l00327"></a>00327 <span class="keywordtype">int</span> njb3_turnoff_flashing(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00328"></a>00328 <span class="keywordtype">int</span> njb3_get_owner_string (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keywordtype">char</span> *name);
<a name="l00329"></a>00329 <span class="keywordtype">int</span> njb3_set_owner_string (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keyword">const</span> <span class="keywordtype">char</span> *name);
<a name="l00330"></a>00330 <a class="code" href="structnjb__time__struct.html">njb_time_t</a> *njb3_get_time(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00331"></a>00331 <span class="keywordtype">int</span> njb3_set_time(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <a class="code" href="structnjb__time__struct.html">njb_time_t</a> *time);
<a name="l00332"></a>00332 <span class="keywordtype">int</span> njb3_reset_get_track_tag (<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00333"></a>00333 <a class="code" href="structnjb__songid__struct.html">njb_songid_t</a> *njb3_get_next_track_tag (<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00334"></a>00334 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a7d8dffadc9e0e8238ffc840075cc2293">njb3_reset_get_playlist_tag</a> (<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00335"></a>00335 <a class="code" href="structnjb__playlist__struct.html">njb_playlist_t</a> *njb3_get_next_playlist_tag (<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00336"></a>00336 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#aed14b36adbbd0c6d045f0be3e86c5a37">njb3_reset_get_datafile_tag</a> (<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00337"></a>00337 <a class="code" href="structnjb__datafile__struct.html">njb_datafile_t</a> *njb3_get_next_datafile_tag (<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00338"></a>00338 <span class="keywordtype">int</span> njb3_read_keys(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00339"></a>00339 <a class="code" href="structnjb__keyval__struct.html">njb_keyval_t</a> *njb3_get_keys(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00340"></a>00340 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a956618fea29be076067bf608190398bf">njb3_request_file_chunk</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t fileid, u_int32_t offset);
<a name="l00341"></a>00341 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#abaa0008a62887dbbd36f6b27a8e740d8">njb3_get_file_block</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *data, u_int32_t maxsize);
<a name="l00342"></a>00342 u_int32_t njb3_create_file(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *ptag, u_int32_t tagsize, u_int16_t database);
<a name="l00343"></a>00343 u_int32_t njb3_send_file_chunk(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *chunk, u_int32_t chunksize, u_int32_t fileid);
<a name="l00344"></a>00344 <span class="keywordtype">int</span> njb3_send_file_complete(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t fileid);
<a name="l00345"></a>00345 <span class="keywordtype">int</span> njb3_create_folder(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keyword">const</span> <span class="keywordtype">char</span> *name, u_int32_t *folderid);
<a name="l00346"></a>00346 <span class="keywordtype">int</span> njb3_delete_item(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t itemid);
<a name="l00347"></a>00347 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a37d979a879932b2fe83ada01e5bc1f0b">njb3_update_16bit_frame</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t itemid, u_int16_t frameid, u_int16_t value);
<a name="l00348"></a>00348 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#af4c77c8c12bea8f1a8c125e70019d5c1">njb3_update_string_frame</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t itemid, u_int16_t frameid, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *str);
<a name="l00349"></a>00349 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a2ebd3fa717d5de9b1031a4a0afbab84f">njb3_update_tag</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t trackid, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *ptag, u_int32_t ptagsize);
<a name="l00350"></a>00350 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a91831b3fc1d2c5ccafd2f62629733074">njb3_create_playlist</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, <span class="keywordtype">char</span> *name, u_int32_t *plid);
<a name="l00351"></a>00351 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a120bb9ef7afb94102b2e1f29515de0dd">njb3_add_multiple_tracks_to_playlist</a> (<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t *plid, u_int32_t *trids, u_int16_t ntracks);
<a name="l00352"></a>00352 <span class="keywordtype">int</span> njb3_adjust_volume(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int16_t value);
<a name="l00353"></a>00353 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a6fe00399de0e30cfd70220b28c49e781">njb3_control_eax_processor</a> (<a class="code" href="structnjb__struct.html">njb_t</a> * njb, u_int16_t state);
<a name="l00354"></a>00354 <span class="keywordtype">int</span> njb3_adjust_eax(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int16_t eaxid, u_int16_t patchindex, u_int16_t active, u_int16_t scalevalue);
<a name="l00355"></a>00355 <span class="keywordtype">void</span> njb3_read_eaxtypes(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00356"></a>00356 <a class="code" href="structnjb__eax__struct.html">njb_eax_t</a> *njb3_get_nexteax(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00357"></a>00357 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#aea0edf60a976fbe68c0fd3e0aae10984">njb3_announce_firmware</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t size);
<a name="l00358"></a>00358 u_int32_t <a class="code" href="protocol3_8c.html#a2b9e5af429aa7667396bf28ef310b698">njb3_send_firmware_chunk</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb, u_int32_t chunksize, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *chunk);
<a name="l00359"></a>00359 <span class="keywordtype">int</span> <a class="code" href="protocol3_8c.html#a11c183e62511af9c23f15e5f1d7a1912">njb3_get_firmware_confirmation</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00360"></a>00360 <span class="keywordtype">void</span> <a class="code" href="protocol3_8c.html#a6cb6360d563df97d2ee763389ca94343">njb3_destroy_state</a>(<a class="code" href="structnjb__struct.html">njb_t</a> *njb);
<a name="l00361"></a>00361 
<a name="l00362"></a>00362 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sat Jun 25 2011 for libnjb by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>