aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Portable/pmp_njb/Nmsdk.h
blob: 892e04bb91cfe4455e6c3b6106cb345a0603babb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
/////////////////////////////////////////////////////////////////////////////////////
// 
// File:	nmsdk.h
//
// Purpose:	Combination of the Jukebox SDK2 header file and the NomadII SDK2 header file.
// 
// Notes:	Please make sure to include the COM Stuffs <Objbase.h> and <initguid.h> 
//			at the beginning of the application programs. Otherwise, it will get Link Errors.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Creative Technology Ltd., 2001.  All rights reserved.
// 
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// nmsdk.h : main header file for export
// Version: 1.0.7.0
/////////////////////////////////////////////////////////////////////////////

#ifndef __nmsdk_h__
#define __nmsdk_h__

//
// COM Interface Declaration
// 

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus


//////////////////////////////////////////////////////////////////////////
//								Class ID							//
//////////////////////////////////////////////////////////////////////////
//CLSID CLSID_CTJukeBox2:
// {BD1A6357-3E9B-4f1b-8375-AEE989ED6C5E}
DEFINE_GUID(CLSID_CTJukeBox2, 
0xbd1a6357, 0x3e9b, 0x4f1b, 0x83, 0x75, 0xae, 0xe9, 0x89, 0xed, 0x6c, 0x5e);

//CLSID CLSID_CTNOMAD2:
// {0EBE3156-FD3A-4f5c-ABDB-71E3BEEAD091}
DEFINE_GUID(CLSID_CTNOMAD2, 
0xebe3156, 0xfd3a, 0x4f5c, 0xab, 0xdb, 0x71, 0xe3, 0xbe, 0xea, 0xd0, 0x91);


//////////////////////////////////////////////////////////////////////////
//								return codes							//
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////
//			JukeBox & NomadII shared stuffs			//
//////////////////////////////////////////////////////
// Additional Error codes
#define DAPSDK_SUCCESS							0x00
// General Error
#define DAPSDK_FAILED							0x01
#define DAPSDK_E_DEVICE_BUSY					0x02
#define DAPSDK_E_STORAGE_FULL					0x03
#define DAPSDK_E_SETTIME_REJECTED				0x05
#define DAPSDK_E_ITEM_SIZE_MISSING				0x14	//NMJB_E_TRACK_SIZE_MISSING
#define DAPSDK_E_ITEM_UPLOAD_DENIED				0x18	//NMJB_E_TRACK_UPLOAD_DENIED
#define DAPSDK_E_PLAYER_NOT_CONNECTED			0x80
#define DAPSDK_E_CANCELLED						0x81
#define DAPSDK_E_PORT_UNAVAILABLE				0x82
#define DAPSDK_E_OUT_OF_MEMORY					0x83
#define DAPSDK_E_FILEOPEN_ERR					0x84
#define DAPSDK_E_ITEM_NOT_FOUND					0x85
#define DAPSDK_E_LOAD_COMPONENTS_FAILED			0x86
#define DAPSDK_E_ID_INVALID						0x87
#define DAPSDK_E_FILETYPE_ILLEGAL				0x88
#define DAPSDK_E_LOADRES_FAIL					0x89
#define DAPSDK_E_FORMAT_NOT_FOUND				0x8a
#define DAPSDK_E_FILE_ALREADY_EXISTS			0x8b
#define DAPSDK_E_LIB_CORRUPTED					0x8c
#define DAPSDK_E_LIB_BUSY						0x8d
#define DAPSDK_E_FILE_READ_WRITE_FAILED			0x8e	//NMJB_E_FILE_WRITE_FAILED
#define DAPSDK_E_INVALID_FILEPATH				0x8f
#define DAPSDK_E_UNSUPPORTED					0x91
#define DAPSDK_E_NORIGHTS						0x95
#define DAPSDK_E_UNDEFINED_ERR					0xff


//////////////////////////////////////////////////////
//					NomadII stuffs					//
//////////////////////////////////////////////////////
#define DAPSDK_E_SMARTMEDIA_WRITE_PROTECTED		0x98
#define DAPSDK_E_NO_STORAGE						0x99	//No internal media or smart media

//////////////////////////////////////////////////////
//					JukeBox stuffs					//
//////////////////////////////////////////////////////
// General Error
#define DAPSDK_E_HD_GENERAL_ERROR				0x04
// Track Management Error
#define DAPSDK_E_TRACK_NOT_FOUND				0x10
#define DAPSDK_E_TRACK_ALREADY_EXIST			0x11
#define DAPSDK_E_TRACK_TITLE_MISSING			0x12
#define DAPSDK_E_TRACK_CODEC_MISSING			0x13
#define DAPSDK_E_TRACK_IO_OPERATION_ABORTED		0x15
#define DAPSDK_E_TRACK_READ_WRITE_ERROR			0x16
#define DAPSDK_E_TRACK_NOT_OPENED				0x17
// Playlist Error
#define DAPSDK_E_PL_NOT_FOUND					0x20
#define DAPSDK_E_PL_ALREADY_EXIST				0x21
#define DAPSDK_E_PL_ITEM_NOT_FOUND				0x22
#define DAPSDK_E_PL_ITEM_ALREADY_EXIST			0x23
//Additional
#define DAPSDK_E_DISKFULL_FOR_DOWNLOAD			0x90


#define DAPSDK_E_STATUS_TIMEOUT					0x06

// Transport Control Error
#define DAPSDK_E_END_OF_TRACK					0x30
#define DAPSDK_E_END_OF_LIST					0x31
#define DAPSDK_E_CODEC_NOT_SUPPORTED			0x32
#define DAPSDK_E_DATA_CORRUPTED					0x33
#define DAPSDK_E_SAMPLING_RATE_NOT_SUPPORTED	0x34
#define DAPSDK_E_DECODING_ERROR					0x35
#define DAPSDK_E_POSITION_OUTOF_RANGE			0x36
#define DAPSDK_E_NOT_STOPPED					0x37

// Audio Control Error
#define DAPSDK_E_UNKNOW_PROPERTY				0x40
#define DAPSDK_E_VALUE_OUTOF_RANGE				0x41

// USB Transaction Error
#define DAPSDK_E_DATA_FILE_NOT_FOUND			0x60
#define DAPSDK_E_DATA_FILE_TOO_BIG				0x61
#define DAPSDK_E_DATA_FILE_ALREADY_EXIST		0x62
#define DAPSDK_E_TOO_MANY_DATA_FILES			0x63

//additional
#define DAPSDK_E_WMDM_INIT_FAILED				0x92
#define DAPSDK_E_INVALID_ARGUMENT				0x93
#define DAPSDK_E_PARENTNODE_NOT_EXIST			0x94
#define DAPSDK_E_NORIGHTS						0x95
#define DAPSDK_E_PATH_EXCESS_LEN				0x96
#define DAPSDK_E_LOAD_PROC_FAILED				0x97

// New Error code for MultiApplication assess of Nomad Jukebox 2/3/Zen
#define	DAPSDK_E_PMSMAN_CREATEDIRECTORY_FAILED	0x0100
#define	DAPSDK_E_DEVICE_WRITE_FAILED			0x0200
#define	DAPSDK_E_DEVICE_READ_FAILED				0x0300
#define	DAPSDK_E_DB_INVALID_REQUEST_ID			0x0400
#define	DAPSDK_E_DB_INVALID_NODE_ID				0x0500
#define	DAPSDK_E_DWNTHRD_CREATEMETADATA_FAILED	0x0600
#define	DAPSDK_E_DEVINFO_INVALID_INDEX			0x0700
#define	DAPSDK_E_INVALID_DEVICESETTINGTYPE		0x0800
#define	DAPSDK_E_FILESIZE_TOO_BIG				0x0900
#define	DAPSDK_E_AUDIOFILE_FORMAT				0x0A00
#define	DAPSDK_E_AUDIOFILE_INVALID				0x0B00
#define	DAPSDK_E_ACCESS_DENIED					0x0C00
#define	DAPSDK_E_FILE_NOT_FOUND					0x0D00
#define	DAPSDK_E_EOF							0x0E00
#define	DAPSDK_E_COOKIE							0x0F00
#define	DAPSDK_E_PLAYBACK_INPROGRESS			0x1000
#define	DAPSDK_E_TRANSFER_INPROGRESS			0x1100
#define	DAPSDK_E_BUFFER_NOT_ENOUGH				0x1200

// New Error code for Data Folder of Nomad Jukebox 2/3/Zen
#define	DAPSDK_E_NOT_A_FOLDER					0x1400	// the target file is not a folder
#define	DAPSDK_E_FOLDER_NOT_EMPTY				0x1600	// the target folder is not empty
#define	DAPSDK_E_FOLDER_EXIST					0x1700	// the target folder exist
#define	DAPSDK_E_FOLDER_NOTEXIST				0x1800	// the target folder does not exist
#define	DAPSDK_E_PARENTFOLDER_NOTEXIST			0x1900	// the target parent folder does not exist
#define	DAPSDK_E_FILEPATH_TOOLONG				0x1A00	// the target file path is too long 
#define	DAPSDK_E_FILENAME_TOOLONG				0x1B00	// the target file name is too long 
#define	DAPSDK_E_INVALID_OPERATION				0x1E00	// the operation cannot be perform


//////////////////////////////////////////////////////////////////////////
//						Definitions for WM Messages						//
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////
//			JukeBox & NomadII shared stuffs			//
//////////////////////////////////////////////////////
// Download message
#define WM_DAPSDK_DOWNLOAD_PROGRESS	WM_USER+500
#define WM_DAPSDK_DOWNLOAD_COMPLETE	WM_USER+501

// Upload message
#define WM_DAPSDK_GETITEM_PROGRESS	WM_USER+502
#define WM_DAPSDK_GETITEM_COMPLETE	WM_USER+503

//////////////////////////////////////////////////////
//					JukeBox stuffs					//
//////////////////////////////////////////////////////
// Device change message	
#define WM_DAPSDK_JUKEBOX_REMOVAL	WM_USER+508
#define WM_DAPSDK_JUKEBOX_ARRIVAL	WM_USER+509
// Playback message
#define WM_DAPSDK_PLAYBACK_COMPLETE	WM_USER+504
#define WM_DAPSDK_PLAYLIST_COMPLETE	WM_USER+505
#define WM_DAPSDK_PLAYBACK_ERROR	WM_USER+506
#define WM_DAPSDK_PLAYBACK_PROGRESS	WM_USER+507


// New callback messages for MultiApplication assess of Hotcake
// Notification Messages for database change
#define		WM_DAPSDK_CHANGE_BASE					WM_USER + 200
#define		WM_DAPSDK_MUSIC_ADD_FILE				WM_DAPSDK_CHANGE_BASE + 0	// wParam = NodeId added, lParam = nil
#define		WM_DAPSDK_MUSIC_DEL_FILE				WM_DAPSDK_CHANGE_BASE + 1	// wParam = NodeId deleted, lParam = nil
#define		WM_DAPSDK_MUSIC_SETATTR_FILE			WM_DAPSDK_CHANGE_BASE + 2	// wParam = NodeId edited, lParam = nil
#define		WM_DAPSDK_DATA_ADD_FILE					WM_DAPSDK_CHANGE_BASE + 3	// wParam = NodeId added, lParam = nil
#define		WM_DAPSDK_DATA_DEL_FILE					WM_DAPSDK_CHANGE_BASE + 4	// wParam = NodeId deleted, lParam = nil
#define		WM_DAPSDK_DATA_SETATTR_FILE				WM_DAPSDK_CHANGE_BASE + 5	// wParam = NodeId edited, lParam = nil
#define		WM_DAPSDK_PLAYLIST_ADD_FILE				WM_DAPSDK_CHANGE_BASE + 6	// wParam = NodeId added, lParam = nil
#define		WM_DAPSDK_PLAYLIST_DEL_FILE				WM_DAPSDK_CHANGE_BASE + 7	// wParam = NodeId deleted, lParam = nil
#define		WM_DAPSDK_PLAYLIST_SETATTR_FILE			WM_DAPSDK_CHANGE_BASE + 8	// wParam = NodeId edited, lParam = nil
#define		WM_DAPSDK_PLAYLIST_ITEM_CHANGE			WM_DAPSDK_CHANGE_BASE + 9	// wParam = PlaylistNodeId affected, lParam = nil
#define		WM_DAPSDK_STORAGEINFO_CHANGE			WM_DAPSDK_CHANGE_BASE + 10	// wParam = deviceIndex that change occurred, lParam = nil


#define WM_DAPSDK_ADDITEM_PROGRESS	WM_USER+500
#define WM_DAPSDK_ADDITEM_COMPLETE	WM_USER+501


/////////////////////////////////////////////////////////////////////////
//							struct defines								//
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////
//			JukeBox & NomadII shared stuffs			//
//////////////////////////////////////////////////////
typedef struct _DAPSDK_DATE_TIME
{
	short Year, Month, Day, DayOfWeek;
	short Hour, Min, Sec, MilliSec;
} DATE_TIME, *PDATE_TIME;

typedef struct _DAPSDK_FORMAT_INFO
{
	long	lCodecID;
	UCHAR	szCodecName[128];
	long	lSamplingRate;
	long	lNumChannel;
} FORMAT_INFO, *PFORMAT_INFO;

//-- SDK and firmware version info structure --//
//
//	used in GetSDKVersion()
//	used in GetDeviceProperties( kFirmwareVersion, kHardwareVersion)
typedef struct _DAPSDK_VERSION
{
	WORD	major;
	WORD	minor;
	WORD	build;
	WORD	specialBuild;
} DAPSDK_VERSION, *PDAPSDK_VERSION;

//-- Memory Storage Information Structure --//
typedef struct _DAPSDK_STORAGE_INFO
{
	ULONG	totalH;
	ULONG	totalL;
	ULONG	freeH;
	ULONG	freeL;
} DAPSDK_STORAGE_INFO, *PDAPSDK_STORAGE_INFO;

//-- Identification structure --//
// same for RootItem, ParentItem and Item now	//
typedef struct _DAPSDK_ID
{
	long	lID;			// stores the unique ID
	long	lType;			// stores the type (see enum above)
	BSTR	bstrName;		// stores the name
} DAPSDK_ID, *PDAPSDK_ID;

//////////////////////////////////////////////////////
//					NomadII stuffs					//
//////////////////////////////////////////////////////
typedef struct _DAPSDK_RADIOPRESET
{
	DWORD	dwPresetIndex;
	DWORD	dwPresetValue;
} RADIOPRESET, *PRADIOPRESET;


// device info struct
typedef struct _DAPSDK_DEVICE_INFO
{
    BYTE cDeviceId[16];         // player's ID
    long dwFirmwareVersion;    // player's firmware version
    long dwHardwareVersion;    // player's hardware version
	char cDeviceName[32];		// player's name w/o NULL terminator
	BYTE byPowerSource;			// player's power source status in percent
} DAPSDK_DEVICE_INFO, *PDAPSDK_DEVICE_INFO;

enum
{
	kASCII = 0,
	kBINARY,
	kUNICODE,
};

//////////////////////////////////////////////////////
// Item type for Jukebox (used by lRootItemType,	//
// lParentItemType, lItemType parameter)			//
//////////////////////////////////////////////////////
enum
{
	kAudioTrackType = 1,	// this is a audio track
	kPlaylistType,			// this is a track in the playlist
	kDataFileType,			// this is a data file
	kDataFolderType,	// this is a data file folder
};

/////////////////////////////////////////////////////////
// Item type for NomadII (used in lItemType parameter) //
/////////////////////////////////////////////////////////
enum
{
	kInternalMemType = 0, // this item resides in internal memory
	kExternalMemType,	  // this item resides in external (removeable) media
};


// Device Property Type Constant
//-- Device Property type (used by lDevicePropertyType parameter in --//
//	GetDeviceProperties/SetDeviceProperties 			 --//
enum
{
//////////////////////////////////////////////////////
//			JukeBox & NomadII shared stuffs			//
//////////////////////////////////////////////////////
	kDeviceSerialNumberValue = 1,	// GET, <NOMAD II>given the Item type
									// in "lpValue" parameter, the return value
									// is a pointer to the serial number 
									// of the specified media.
	kFirmwareVersion,		// GET, return value is a pointer to
							// 	DAPSDK_VERSION structure indicating the
							//	current firmware version in the device.
	kDeviceNameString,		// GET, return value is a pointer to
							//  BSTR string.
	kPowerSourceValue,
	kStorageInfoStruct,		// GET, return value is a pointer to 
							//	DAPSDK_STORAGE_INFO structure indicating
							//	the current memory usage.
	kDateTimeStruct,		// GET/SET, return/set value is a pointer to
							//	DATE_TIME structure (defined in SDK 1.0)
	kOwnerNameString,		// GET/SET, return/set value is a pointer to BSTR
							//	string.
	kAudioFormatCount,		// GET, return value is a pointer to the number of
							//	audio format supported by device.
	kAudioFormatInfoStruct,	// GET, given the index value in "lpValue"
							//	parameter, the return value is a pointer to
							// 	FORMATINFO structure (defined in SDK 1.0).
	kLangEncodeSupport,		// GET, returns unsigned long value
							// 0x01 == Latin 1(CP1252), 0x80000000 == UNICODE

//////////////////////////////////////////////////////
//					JukeBox stuffs					//
//////////////////////////////////////////////////////
	kHardwareVersion,		// GET, return value is a pointer to
							// 	DAPSDK_VERSION structure indicating the
							//	current hardware version in the device.
	kAudioVolumeValue,		// GET/SET, return/set value is the pointer to the
							//	volume level in percentage.
	kAudioMuteValue,		// GET/SET, return/set value is the pointer to the
							//	Mute status (1=on, 0=off).
							//	Treble level in percentage.
	kEAXCount,				// GET, return value is the pointer to the number
							//	of EAX settings.
	kEAXNameString,			// GET, given the index value in "lpValue"
							//	parameter, the return value is a pointer to
							//	a BSTR string.
	kEAXAmountValue,		// GET/SET, given the index value in "lpValue"
							//	parameter, the return value is the effect
							//	amount in percentage.
	kEAXCurrentIndex,		// GET/SET, the value in "lpValue" is used to set
							//	or retrieve the current EAX selection.
	kAudioEQPresetCount,	// GET, return value is the pointer to the number
							//	of EQ settings.
	kAudioEQNameString,		// GET, given the index value in "lpValue"
							//	parameter, the return value is a pointer to
							//	a BSTR string.
	kAudioEQAmountValue,	// GET/SET, return/set value is the pointer to the
							//	EQ amount in percentage.
	kAudioEQCurrentIndex,	// GET/SET, the value in "lpValue" is used to set
							//	or retrieve the current EQ selection.

//////////////////////////////////////////////////////
//					NomadII stuffs					//
//////////////////////////////////////////////////////
	kFMRadioPresetCount,	// GET, returns pointer to number of FM radio 
							// presets available in the player.
	kFMRadioPresetValue,		// GET/SET, given the preset index value, 
							// returns an existing value or sets a new
							// preset FM preset. Value in kHz.	
	kFormatStorage			// SET, Do format storage.
};
//Note that all index value is zero-based. Client should call the "kxxxxxxCount" property first before trying to get the value for individual settings in list-type of properties, i.e. kEAXNameString, kAudioFormatInfoStruct...
//Not all properties are readable and writable, some are read-only attributes. Those properties that are read-only are marked with the "GET" strings and those that are read and writable are marked as "GET/SET". Client should not call SetDeviceProperties() with the read-only property type, such call would fail.
//New Property types maybe supported in future by simply adding into the enum list, and publish to developers.


//////////////////////////////////////////////////////
//					JukeBox stuffs					//
//////////////////////////////////////////////////////
//-- Playback operation type (used by lPlayOperationType parameter in --//
//-- PlayControl() & QueueControl()) --//
enum
{
	kPlayTrack = 1,			// lpValue stores the pointer to the
							//	DAPSDK_ITEM_ID structure.
	kStopTrack,				// lpValue is not used, stop current track, no op
							//	if no track is currently playing.
	kPauseTrack,			// lpValue is not used, pause current track, no op
							//	if no track is currently playing.
	kSetPlaybackPosition,	// lpValue stores the pointer to the new playback
							//	position.
	kQueueTrack,			// lpValue stores the pointer to the
							//	DAPSDK_ITEM_ID structure.
	kClearQueue,			// lpValue is not used, clear existing queue.
};

#define TITLE				"TITLE"
#define FILESIZE			"FILE SIZE"
#define CODEC				"CODEC"
#define ALBUM				"ALBUM"
#define ARTIST				"ARTIST"
#define GENRE				"GENRE"
#define LENGTH				"LENGTH"
#define TRACKNUM			"TRACK NUM"
#define YEAR				"YEAR"
#define PLAYONLY			"PLAYONLY"
#define TRACKID				"TRACK ID"

// new attribute for datafile and datafolder
#define MOD_FILETIME		"MODIFIED FILETIME"
#define FILE_ATTRIB			"FILE ATTRIB"
#define PARENT_FOLDER		"PARENT FOLDER"
#define FOLDERNAME			"FOLDER NAME"	// data folder name for Nomad Jukebox
#define MULTI_ATTRIB		"MULTI ATTRIB"	// this is for user to change multiple file attribute at one time.

#define FILENAME			"FILE NAME"		// file name for Nomad II, data file name for Nomad Jukebox

#define ALLTRACKSKEY		-1

//////////////////////////////////////////////////////
//					NomadII stuffs					//
//////////////////////////////////////////////////////
#define DOS_FILEATTRIB		"DOS_FILEATTRIB"
#define DOS_DATETIME		"DOS_DATETIME"


//////////////////////////////////////////////////////////////////////////
//					ICTJukebox (Interface 1) Methods					//
//////////////////////////////////////////////////////////////////////////

// {DFC9207F-4B64-11D4-A4ED-00A0C98E46CC}
DEFINE_GUID(IID_ICTJukebox, 
0xdfc9207f, 0x4b64, 0x11d4, 0xa4, 0xed, 0x00, 0xa0, 0xc9, 0x8e, 0x46, 0xcc);

interface ICTJukebox : public IUnknown
{
	virtual HRESULT		STDMETHODCALLTYPE	CancelTransfer(
									/*[in]*/long lDeviceID) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	RenamePlaylist(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lPlaylistID, 
									/*[in]*/BSTR bstrName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	RemoveTracksFromPlaylist(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lTrackCount, 
									/*[in]*/long* lpTrackList, 
									/*[in]*/long lPlaylist) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	AddTracksToPlaylist(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lTrackCount, 
									/*[in]*/long* lpTrackList, 
									/*[in]*/long lPlaylist) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	InsertPlaylist(
									/*[in]*/long lDeviceID, 
									/*[in]*/BSTR bstrPlaylistName, 
									/*[out]*/long* lpPlaylistID) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	DeletePlaylist(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lPlaylistID) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindNextTrackInPlaylist(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lPlaylistID, 
									/*[out]*/long* lpTrackID, 
									/*[out]*/BSTR* lpbstrTrackName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindFirstTrackInPlaylist(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lPlaylistID, 
									/*[out]*/long* lpTrackID, 
									/*[out]*/BSTR* lpbstrTrackName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindNextPlaylist(
									/*[in]*/long lDeviceID, 
									/*[out]*/long* lpPlaylistID, 
									/*[out]*/BSTR* lpbstrPlaylistName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindFirstPlaylist(
									/*[in]*/long lDeviceID, 
									/*[out]*/long* lpPlaylistID, 
									/*[out]*/BSTR* lpbstrPlaylistName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	ChangeTrackInfo(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lTarckID, 
									/*[in]*/long lSize, 
									/*[in]*/IUnknown* lpTrackInfo) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	DeleteTrack(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lTrackID) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	InsertTrack(
									/*[in]*/long lDeviceID, 
									/*[in]*/BSTR bstrFilePath, 
									/*[in]*/long lSize, 
									/*[in]*/IUnknown* lpTrackInfo, 
									/*[out]*/long* lpTrackID) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	GetTrackInfo(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lTrackID, 
									/*[in]*/long lInSize, 
									/*[out]*/long* lpOutSize, 
									/*[out]*/IUnknown* lpTrackInfo) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindNextTrack(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lKeyID, 
									/*[out]*/long* lpTrackID, 
									/*[out]*/BSTR* lpbstrName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindFirstTrack(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lKeyID, 
									/*[out]*/long* lpTrackID, 
									/*[out]*/BSTR* lpbstrName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindNextKey(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lRootKeyID, 
									/*[out]*/long* lpKeyID, 
									/*[out]*/BSTR* lpbstrName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindFirstKey(
									/*[in]*/long lDeviceID, 
									/*[in]*/long lRootKeyID, 
									/*[out]*/long* lpKeyID, 
									/*[out]*/BSTR* lpbstrName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindNextRootKey(
									/*[in]*/long lDeviceID, 
									/*[out]*/long* lpRootKeyID, 
									/*[out]*/BSTR* lpbstrName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindFirstRootKey(
									/*[in]*/long lDeviceID, 
									/*[out]*/long* lpRootKeyID, 
									/*[out]*/BSTR* lpbstrName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	SetOwnerName(
									/*[in]*/long lDeviceID, 
									/*[in]*/BSTR bstrName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	GetOwnerName(
									/*[in]*/long lDeviceID, 
									/*[out]*/BSTR* lpbstrName) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	SetDateTime(
									/*[in]*/long lDeviceID, 
									/*[out]*/IUnknown* lpDateTime) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	GetDateTime(
									/*[in]*/long lDeviceID, 
									/*[out]*/IUnknown* lpDateTime) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindNextFormatSupport(
									/*[in]*/long lDeviceID, 
									/*[out]*/IUnknown* lpFormatInfo) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	FindFirstFormatSupport(
									/*[in]*/long lDeviceID, 
									/*[out]*/IUnknown* lpFormatInfo) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	GetStorageInfo(
									/*[in]*/long lDeviceID, 
									/*[out]*/unsigned long* lpTotalMemHigh, 
									/*[out]*/unsigned long* lpTotalMemLow, 
									/*[out]*/unsigned long* lpFreeMemHigh, 
									/*[out]*/unsigned long* lpFreeMemLow ) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	GetDeviceInfo(
									/*[in]*/long lDeviceID, 
									/*[out]*/IUnknown* lpDeviceInfo) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	GetDeviceCount(
									/*[out]*/long* lpDeviceCount) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	SetCallbackWindow(
									/*[in]*/long lDeviceID, 
									/*[in]*/long hWnd) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	GetSDKVersion(
									/*[out]*/long* lpVersion) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	ShutDown() = 0;
	virtual HRESULT		STDMETHODCALLTYPE	Initialize() = 0;

};


//////////////////////////////////////////////////////////////////////////
//					ICTJukebox2 (Interface 2) Methods					//
//////////////////////////////////////////////////////////////////////////

DEFINE_GUID(IID_ICTJukebox2, 
0xdfc92080, 0x4b64, 0x11d4, 0xa4, 0xed, 0x00, 0xa0, 0xc9, 0x8e, 0x46, 0xcc);

interface ICTJukebox2 : public IUnknown
{
	virtual HRESULT STDMETHODCALLTYPE Initialize2() = 0;
	virtual HRESULT STDMETHODCALLTYPE ShutDown2() = 0;
	virtual HRESULT STDMETHODCALLTYPE SetCallbackWindow2(
							long		lDeviceID,
							long		hWnd ) = 0;
	virtual HRESULT STDMETHODCALLTYPE GetDeviceCount2(
							long*		lpDeviceCount ) = 0;

	//-- Canceling I/O --//
	virtual HRESULT STDMETHODCALLTYPE CancelTransfer2(
							long		lDeviceID ) = 0;


	//-- GetSDKVersion2() Fucntion Descriptions --//
	// This function overides the same function in interface 1, this is to
	// return a more meaningful version information to the client which is
	// clearly specified in the DAPSDK_VERSION structure
	virtual HRESULT STDMETHODCALLTYPE GetSDKVersion2(
							IUnknown* 	lpSDKVersion ) = 0;


	//_______________________ Querying RootItem __________________________//

	virtual HRESULT STDMETHODCALLTYPE FindFirstRootItem	(
							long		lDeviceID,
							IUnknown*	lpRootItemID ) = 0;
	virtual HRESULT STDMETHODCALLTYPE FindNextRootItem	(
							long		lDeviceID,
							IUnknown*	lpRootItemID ) = 0;

	//______________________ Querying ParentItem __________________________//

	virtual HRESULT STDMETHODCALLTYPE FindFirstParentItem	(
							long		lDeviceID,
							IUnknown*	lRootItemID,
							IUnknown*	lpParentItemID ) = 0;
	virtual HRESULT STDMETHODCALLTYPE FindNextParentItem	(
							long		lDeviceID,
							IUnknown*	lRootItemID,
							IUnknown*	lpParentItemID ) = 0;


 	//______________________ ParentItem Management __________________________	//

	//-- AddParentItem() Fucntion Descriptions --//
	// Client can only add Parent Item of the same type as the RootItem. For
	// example, client cannot add a kDataFileType Parent item into a RootItem
	// type of kAudioTrackType.
	//
	// As of current firmware implementation, client can only add ParentItem
	// into a RootItem that has a type of kPlaylistType. Adding ParentItem into
	// other RootItem type will fail.
	virtual HRESULT STDMETHODCALLTYPE AddParentItem	(
							long 		lDeviceID,
							IUnknown*	lRootItemID,
							IUnknown*	lParentItemID ) = 0;

	//-- DeleteParentItem() Function Description --//
	// Client can only delete ParentItem of type kPlaylistType. Deleting other
	// ParentItem type will fail.
	virtual HRESULT STDMETHODCALLTYPE DeleteParentItem	(
							long		lDeviceID,
							IUnknown*	lParentItemID ) = 0;

	//-- RenameParentItem() Function Description --//
	// Client can only rename ParentItem of type kPlaylistType. Renaming other
	// ParentItem type will fail.
	//
	// The updated DAPSDK_PARENTITEM_ID structure is returned in lParentItemID
	// parameter.
	virtual HRESULT STDMETHODCALLTYPE RenameParentItem	(
							long		lDeviceID,
							IUnknown*	lParentItemID,
							BSTR	bstrNewParentItemName ) = 0;


	//__________________________ Querying Item ______________________________//

	virtual HRESULT STDMETHODCALLTYPE FindFirstItem	(
							long		lDeviceID,
							IUnknown*	lParentItemID,
							IUnknown*	lpItemID ) = 0;
	virtual HRESULT STDMETHODCALLTYPE FindNextItem		(
							long		lDeviceID,
							IUnknown*	lParentItemID,
							IUnknown*	lpItemID ) = 0;


	//_____________________ Getting Item Attributes __________________________//

	//-- GetItemAttribute() Function Description --//
	// This function returns the TrackInfo data for all Item type. But for
	// kDataFileType and kPlaylistFileType, the TrackInfo data contain only
	// file name, file type and file size. In contrast, the item attribute
	// for a kAudioTrackType may contain all information similar to the ID3tag
	// information that a typical MP3 file has.
	virtual HRESULT STDMETHODCALLTYPE GetItemAttribute	(
							long		lDeviceID,
							IUnknown*	lpItemID,
							long		lInItemInfoSize,
							long*		lOutItemInfoSize,
							IUnknown*	lpItemInfo ) = 0;

	
	//-- SetItemAttribute() Function Description --//
	// This function allows client to set TrackInfo attributes of a
	// kAudioTrackItem only. Setting other item type will fail.
	//
	// It allows client to set a particular attribute data according to the name
	// and type given in the parameters. Note that only one attribute can be set
	// at a time.
	virtual HRESULT STDMETHODCALLTYPE SetItemAttribute	(
							long		lDeviceID,
							IUnknown*	lpItemID,
							BSTR		bstrAttributeName,
							long		lAttributeType,
							long		lAttributeDataSize,
							IUnknown*	lpAttributeData ) = 0;


	//____________________________ Item Management ___________________________//

	//-- AddItem() Function Description --//
	// This function initiates the file download from the computer to the
	// device. Client should call this function to download audio tracks
	// like MP3, WMA and WAVE and data files. Client are not allow
	// to download an item of kPlaylistType, use AddItemsToParentItem to add
	// item of type kPlaylistType.
	virtual HRESULT STDMETHODCALLTYPE AddItem		(
							long		lDeviceID,
							long		lItemType,
							BSTR		bstrSrcFileName,
							long		lItemInfoSize,
							IUnknown*	lpItemInfo) = 0;

	//-- AddItemsToParentItem() Function Description --//
	// Client call this function to add kAudioTrackType item into the ParentItem
	// of type kPlaylistType. Only kAudioTrackType items are accepted, and only
	// ParentItem of type kPlaylistType can accept such addition.
	virtual HRESULT STDMETHODCALLTYPE AddItemsToParentItem(
							long		lDeviceID,
							IUnknown*	lpParentItemID,
							long		lItemIDCount,
							IUnknown*	lpItemIDList ) = 0;

	//-- DeleteItem() Function Description --//
	// Client can call this function to remove item of type kAudioTrackType and
	// kDataFileType. You cannot remove kPlaylistType item here.
	virtual HRESULT STDMETHODCALLTYPE DeleteItem		(
							long		lDeviceID,
							IUnknown*	lpItemID ) = 0;

	//-- GetItem() Function Description --//
	// Client can call this function to retrieve item that are kAudioTrackType
	// and kDataFileType from the device to the computer. Note that client 
	// cannot retrieve item of type kPlaylistItem
	virtual HRESULT STDMETHODCALLTYPE GetItem		(
							long		lDeviceID,
							BSTR	bstrDestinationFileName,
							IUnknown*	lpItemID ) = 0;


	//________________________ Device Properties ____________________________//

	virtual HRESULT STDMETHODCALLTYPE GetDeviceProperties	(
							long		lDeviceID,
							long		lDevicePropertyType,
							IUnknown*	lpValue ) = 0;
	virtual HRESULT STDMETHODCALLTYPE SetDeviceProperties	(
							long		lDeviceID,
							long		lDevicePropertyType,
							IUnknown*	lpValue ) = 0;


	//_______________________ Playback control ______________________________//

	virtual HRESULT STDMETHODCALLTYPE PlayControl		(
							long		lDeviceID,
							long		lPlayOperationType,
							IUnknown*	lpValue ) = 0;
	virtual HRESULT STDMETHODCALLTYPE QueueControl		(
							long		lDeviceID,
							long		lQueueOperationType,
							IUnknown*	lpValue ) = 0;

};

//////////////////////////////////////////////////////////////
//				ICTNomad2 Methods							//
//////////////////////////////////////////////////////////////

// {368953D4-6A2F-4787-BC6F-4047A39A7557}
DEFINE_GUID(IID_ICTNomad2, 
0x368953d4, 0x6a2f, 0x4787, 0xbc, 0x6f, 0x40, 0x47, 0xa3, 0x9a, 0x75, 0x57);
 
interface ICTNomad2 : public IUnknown
{
	virtual HRESULT		STDMETHODCALLTYPE	Initialize() = 0;
	virtual HRESULT		STDMETHODCALLTYPE	ShutDown() = 0;

	virtual HRESULT		STDMETHODCALLTYPE	SetCallbackWindow(
									/*[in]*/long lDeviceID, 
									/*[in]*/long hWnd) = 0;
	virtual HRESULT		STDMETHODCALLTYPE	GetDeviceCount(
									/*[out]*/long* lpDeviceCount) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	CancelTransfer(
									/*[in]*/long lDeviceID) = 0;

	virtual HRESULT		STDMETHODCALLTYPE	GetSDKVersion(
									/*[out]*/IUnknown* lpVersion) = 0;


	//__________________________ Querying Item ______________________________//

	virtual HRESULT STDMETHODCALLTYPE FindFirstItem	(
							long		lDeviceID,
							IUnknown*	lParentItemID,
							IUnknown*	lpItemID ) = 0;
	virtual HRESULT STDMETHODCALLTYPE FindNextItem		(
							long		lDeviceID,
							IUnknown*	lParentItemID,
							IUnknown*	lpItemID ) = 0;


	//_____________________ Getting Item Attributes __________________________//

	//-- GetItemAttribute() Function Description --//
	// This function returns the TrackInfo data for all Item type. But for
	// kDataFileType and kPlaylistFileType, the TrackInfo data contain only
	// file name, file type and file size. In contrast, the item attribute
	// for a kAudioTrackType may contain all information similar to the ID3tag
	// information that a typical MP3 file has.
	virtual HRESULT STDMETHODCALLTYPE GetItemAttribute	(
							long		lDeviceID,
							IUnknown*	lpItemID,
							long		lInItemInfoSize,
							long*		lOutItemInfoSize,
							IUnknown*	lpItemInfo ) = 0;


	//____________________________ Item Management ___________________________//

	//-- AddItem() Function Description --//
	// This function initiates the file download from the computer to the
	// device. Client should call this function to download audio tracks
	// like MP3, WMA and WAVE and data files. Client are not allow
	// to download an item of kPlaylistType, use AddItemsToParentItem to add
	// item of type kPlaylistType.
	virtual HRESULT STDMETHODCALLTYPE AddItem		(
							long		lDeviceID,
							long		lItemType,
							BSTR		bstrSrcFileName,
							long		lItemInfoSize,
							IUnknown*	lpItemInfo) = 0;

	//-- DeleteItem() Function Description --//
	// Client can call this function to remove item of type kAudioTrackType and
	// kDataFileType. You cannot remove kPlaylistType item here.
	virtual HRESULT STDMETHODCALLTYPE DeleteItem		(
							long		lDeviceID,
							IUnknown*	lpItemID ) = 0;

	//-- GetItem() Function Description --//
	// Client can call this function to retrieve item that are kAudioTrackType
	// and kDataFileType from the device to the computer. Note that client 
	// cannot retrieve item of type kPlaylistItem
	virtual HRESULT STDMETHODCALLTYPE GetItem		(
							long		lDeviceID,
							BSTR		bstrDestinationFileName,
							IUnknown*	lpItemID ) = 0;


	//________________________ Device Properties ____________________________//
	
	virtual HRESULT STDMETHODCALLTYPE GetDeviceProperties	(
							long		lDeviceID,
							long		lDevicePropertyType,
							IUnknown*	lpValue ) = 0;
	virtual HRESULT STDMETHODCALLTYPE SetDeviceProperties	(
							long		lDeviceID,
							long		lDevicePropertyType,
							IUnknown*	lpValue ) = 0;

};

#ifdef __cplusplus
}
#endif // __cplusplus

#endif