summaryrefslogtreecommitdiffstats
path: root/systemservice/interface_unified/library/include/system_service/ss_devicedetection_service.h
blob: 134ab1fbdd93104c1ab7dd44ef6e2c6a1865f0cf (plain)
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
/*
 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file ss_devicedetection_service.h
 * @brief This file supports the Device Detection service.
 */

/** @addtogroup BaseSystem
 *  @{
 */
/** @addtogroup system_service
 *  @ingroup BaseSystem
 *  @{
 */
/** @addtogroup device_detection_service
 *  @ingroup system_service
 *  @{
 */

#ifndef _SS_DEVICEDETECTION_SERVER_H_  // NOLINT (build/header_guard)
#define _SS_DEVICEDETECTION_SERVER_H_


#include <native_service/frameworkunified_types.h>
#include <string>
#include "system_service/ss_devicedetection_service_types.h"

/**
 * \~english The max size of the file path.
 */
#define FILEPATH_SIZE  (256)

/**
 * \~english The max size of URL.
 */
#define URL_SIZE  (256)

/**
 * \~english The max size of the device name.
 */
#define SS_DEV_DEVICE_NAME_SIZE (64)

/**
 * \~english The max size of the name.
 */
#define SS_DEV_NAME_SIZE (256)


/**
 * \~english Structure for FuseDAV info.
 */
typedef struct _FuseDAVInfo {
  /**
   * \~english FuseDAV server address
   */
  int8_t  url[URL_SIZE];  // FuseDAV server address
}SS_FuseDAVInfo;

/**
 * \~english Structure for USB device info.
 */
typedef struct _UsbInfo {
  /**
   * \~english Bus Number
   */
  uint8_t  bus_no;    // Bus Number
  /**
   * \~english Device Number
   */
  uint8_t  dev_no;    // Device Number
  /**
   * \~english Vendor ID
   */
  uint16_t  idVendor;  // Vendor ID
  /**
   * \~english Product ID
   */
  uint16_t  idProduct;  // Product ID
  /**
   * \~english reserved area
   */
  uint8_t  reserved[2];
  /**
   * \~english Manufacturer Name
   */
  CHAR  manufacturerName[SS_DEV_NAME_SIZE];  // Manufacturer Name
  /**
   * \~english Product Name
   */
  CHAR  productName[SS_DEV_NAME_SIZE];  //  Product Name
  /**
   * \~english Serial Number
   */
  CHAR  serial_no[SS_DEV_NAME_SIZE];  // Serial Number
  /**
   * \~english Device file path
   */
  int8_t  deviceFile[FILEPATH_SIZE];  // Device file path
}SS_UsbInfo;

/**
 * \~english CID(Card Identification Register Data)of SD/MMC card
 */
typedef struct _CID {
  /**
   * \~english Manufacturer ID
   */
  uint8_t  manufacturerID;      /* Manufacturer ID        */
  /**
   * \~english Application ID
   */
  uint16_t  applicationID;      /* Application ID        */
  /**
   * \~english Product Revision (PRV)
   */
  uint8_t  revision;      /* Product Revision (PRV)    */
  /**
   * \~english Product Serial Number (PSN)
   */
  uint32_t  serialNumber;      /* Product Serial Number (PSN)  */
  /**
   * \~english Product Name (PNM)
   */
  uint8_t  productName[6];      /* Product Name (PNM)      */
  /**
   * \~english Reserved area
   */
  uint8_t  reserve[2];      /* Reserve            */
  /**
   * \~english Manufacture date (MDT)
   */
  uint16_t  manufactureDate;    /* Manufacture date (MDT)    */
}SS_CID;

// CSD(Card Specification Register Data)of SD/MMC card
/**
 * \~english CSD(Card Specification Register Data)of SD/MMC card
 */
typedef struct _CSD {
  /**
   * \~english CSD structure
   */
  uint8_t  csd_structure;      /* CSD structure        */
  /**
   * \~english data read access-time-1
   */
  uint8_t  taac;        /* data read access-time-1    */
  /**
   * \~english data read access-time-2 in CLK cycles (NSAC*100)
   */
  uint8_t  nsac;        /* data read access-time-2 in CLK cycles (NSAC*100)  */
  /**
   * \~english max. data transfer rate
   */
  uint8_t  tran_speed;      /* max. data transfer rate  */
  /**
   * \~english card command classes
   */
  uint16_t  ccc;        /* card command classes      */
  /**
   * \~english max. read data block length
   */
  uint8_t  read_bl_len;      /* max. read data block length  */
  /**
   * \~english partial blocks for read allowed
   */
  uint8_t  read_bl_partial;    /* partial blocks for read allowed  */
  /**
   * \~english write block misalignment
   */
  uint8_t  write_blk_misalign;    /* write block misalignment    */
  /**
   * \~english read block misalignment
   */
  uint8_t  read_blk_misalign;    /* read block misalignment    */
  /**
   * \~english DSR implemented
   */
  uint8_t  dsr_imp;      /* DSR implemented        */
  /**
   * \~english Reserve area 1
   */
  uint8_t  reserve1;      /* Reserve 1          */
  /**
   * \~english device size
   */
  uint32_t  c_size;        /* device size          */
  /**
   * \~english max. read current -VDD min
   */
  uint8_t  vdd_r_curr_min;      /* max. read current @VDD min  */
  /**
   * \~english max. read current -VDD max
   */
  uint8_t  vdd_r_curr_max;      /* max. read current @VDD max  */
  /**
   * \~english max. write current -VDD min
   */
  uint8_t  vdd_w_curr_min;      /* max. write current @VDD min  */
  /**
   * \~english max. write current -VDD max
   */
  uint8_t  vdd_w_curr_max;      /* max. write current @VDD max  */
  /**
   * \~english device size multiplier
   */
  uint8_t  c_size_mult;      /* device size multiplier    */
  /**
   * \~english erase single block enable
   */
  uint8_t  erase_blk_en;      /* erase single block enable  */
  /**
   * \~english erase sector size
   */
  uint8_t  sector_size;      /* erase sector size      */
  /**
   * \~english write protect group size
   */
  uint8_t  wp_grp_size;      /* write protect group size    */
  /**
   * \~english write protect group enable
   */
  uint8_t  wp_grp_enable;      /* write protect group enable  */
  /**
   * \~english write speed factor
   */
  uint8_t  r2w_factor;      /* write speed factor      */
  /**
   * \~english max. write data block length
   */
  uint8_t  write_bl_len;      /* max. write data block length  */
  /**
   * \~english partial blocks for write allowed
   */
  uint8_t  write_bl_partial;    /* partial blocks for write allowed  */
  /**
   * \~english File format group
   */
  uint8_t  file_format_grp;    /* File format group      */
  /**
   * \~english copy flag
   */
  uint8_t  copy;        /* copy flag          */
  /**
   * \~english permanent write protection
   */
  uint8_t  perm_write_protect;    /* permanent write protection  */
  /**
   * \~english temporary write protection
   */
  uint8_t  tmp_write_protect;    /* temporary write protection  */
  /**
   * \~english File format
   */
  uint8_t  file_format;      /* File format          */
  /**
   * \~english Reserve area 2
   */
  uint8_t  reserve2[3];      /* Reserve 2          */
} SS_CSD;

// Structure for SD device info.
/**
 * \~english Structure for SD device info.
 */
typedef struct _SdInfo {
  /**
   * \~english CID
   */
  SS_CID  cid;    // CID
  /**
   * \~english CSD
   */
  SS_CSD  csd;    // CSD
  /**
   * \~english Device file path
   */
  int8_t  deviceFile[FILEPATH_SIZE];  // Device file path
  /**
   * \~english Current Partion No
   */
  int32_t  part_num;  // Current Partion No
  /**
   * \~english Number of partions
   */
  int32_t  nparts;    // Number of partions
}SS_SdInfo;

// Structure for DISC info.
/**
 * \~english Structure for DISC info.
 */
typedef struct _DiscInfo {
  /**
   * \~english Device file path
   */
  int8_t  deviceFile[FILEPATH_SIZE];  // Device file path
  /**
   * \~english Disc Type(eCD, eDVD, eBD)
   */
  EDISC_TYPE  disc_type;      // Disc Type(eCD, eDVD, eBD)
}SS_DiscInfo;

// Structure that is available when SS_DEV_ANY_USB_EV is published.
/**
 * \~english Structure that is available when SS_DEV_ANY_USB_EV is published.
 */
typedef struct _UsbDeviceInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL        bIsDeviceAvailable;  // Insert:TURE, Remove:FALSE
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo    usb_info;    // USB Infomation
}SS_UsbDeviceInfo;

// Structure for device info.
/**
 * \~english Structure for device info.
 */
typedef union _DeviceInfo {
  /**
   * \~english usb device info
   */
  SS_UsbInfo      usb_info;  // usb device info
  /**
   * \~english sd info
   */
  SS_SdInfo    sd_info;  // sd info
  /**
   * \~english disc info
   */
  SS_DiscInfo    disc_info;  // disc info
  /**
   * \~english fusedav info
   */
  SS_FuseDAVInfo   fusedav_info;  // fusedav info
}SS_DeviceInfo;

// Structure for volume label infomation.
/**
 * \~english Structure for volume label infomation.
 */
typedef struct _VolumeInfo {
  /**
   * \~english volume label's availability
   */
  BOOL     volume_label_availability;  // volume label's availability
  /**
   * \~english volume label
   */
  CHAR    volume_label[SS_DEV_NAME_SIZE];  // volume label
}SS_VolumeInfo;

// Structure that is available when SS_DEV_DETECT*_EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT*_EV is published.
 */
typedef struct _MediaDetectInfo {
  /**
   * \~english Deive type(eUSB,eSD...)
   */
  EDEVICE_TYPE   dev_type;      // Deive type(eUSB,eSD...)
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL     bIsDeviceAvailable;    // Insert:TURE, Remove:FALSE
  /**
   * \~english Device Infomation
   */
  SS_DeviceInfo  dev_info;      // Device Infomation
  /**
   * \~english Mount path
   */
  CHAR    deviceMountpath[FILEPATH_SIZE];  // Mount path
  /**
   * \~english  Do Not Used.(This member is for compatibility)
   */
  CHAR    filepathName[FILEPATH_SIZE];  // Do Not Used.(This menber is for compatibility)
  /**
   * \~english FuseDav:TRUE, Not FuseDav:FALSE
   */
  BOOL    bIsFuseDav;
  /**
   * \~english result of mount  NORMAL:SS_DEV_OK, ERR:SS_DEV_ERR_MOUNT
   */
  SS_DEV_ERROR  err_code;      // result of mount  NORMAL:SS_DEV_OK, ERR:SS_DEV_ERR_MOUNT
  /**
   * \~english volume infomation (USB mass storage only support)
   */
  SS_VolumeInfo  volume_info;      // volume infomation (USB mass storage only support)
}SS_MediaDetectInfo, *PSS_MediaDetectInfo;

// Structure that is available when SS_DEV_DETECT_USB_NCM_EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT_USB_NCM_EV is published.
 */
typedef struct _NcmDetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL     bIsDeviceAvailable;    // Insert:TURE, Remove:FALSE
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo  usb_info;      // USB Infomation
  /**
   * \~english Network Name
   */
  int8_t  networkName[SS_DEV_DEVICE_NAME_SIZE];  // Network Name
}SS_NcmDetectInfo;

// Structure that is available when SS_DEV_DETECT_USB__CWORD57__EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT_USB__CWORD57__EV is published.
 */
typedef struct __CWORD57_DetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL     bIsDeviceAvailable;    // Insert:TURE, Remove:FALSE
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo  usb_info;      // USB Infomation
}SS__CWORD57_DetectInfo;

// Structure that is available when SS_DEV_DETECT_USB_ACM_EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT_USB_ACM_EV is published.
 */
typedef struct _AcmDetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL          bIsDeviceAvailable;             // Insert:TURE, Remove:FALSE
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo    usb_info;                       // USB Infomation
  /**
   * \~english ACM device file
   */
  int8_t        deviceFile[FILEPATH_SIZE];      // ACM device file
}SS_AcmDetectInfo;

// Structure that is available when SS_DEV_DETECT_USB_DEV_MNG_EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT_USB_DEV_MNG_EV is published.
 */
typedef struct _DevMngDetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL          bIsDeviceAvailable;             // Insert:TURE, Remove:FALSE
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo    usb_info;                       // USB Infomation
  /**
   * \~english Device Manager device file
   */
  int8_t        deviceFile[FILEPATH_SIZE];      // Device Manager device file
}SS_DevMngDetectInfo;

// Structure that is available when SS_DEV_DETECT_USB_DEV_VEHICLE_CTRL_EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT_USB_DEV_VEHICLE_CTRL_EV is published.
 */
typedef struct _VehicleCtrlDetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL          bIsDeviceAvailable;             // Insert:TURE, Remove:FALSE
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo    usb_info;                       // USB Infomation
  /**
   * \~english Vehicle control device file
   */
  int8_t        deviceFile[FILEPATH_SIZE];      // Vehicle control device file
}SS_VehicleCtrlDetectInfo;

// Structure for audio detect info.
/**
 * \~english Structure for audio detect info.
 */
typedef struct _AudioDetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL bIsDeviceAvailable;
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo usb_info;
  /**
   * \~english Audio control device file
   */
  int8_t audio_ctrl[FILEPATH_SIZE];
  /**
   * \~english Audio Playback device file
   */
  int8_t audio_play[FILEPATH_SIZE];
  /**
   * \~english Audio Capture device file
   */
  int8_t audio_capture[FILEPATH_SIZE];
}SS_AudioDetectInfo; 

// Structure that is available when SS_DEV_DETECT_USB_DSRC_APP_EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT_USB_DSRC_APP_EV is published.
 */
typedef struct _DsrcAppDetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL          bIsDeviceAvailable;             // Insert:TURE, Remove:FALSE
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo    usb_info;                       // USB Infomation
  /**
   * \~english Dsrc Application device file
   */
  int8_t        deviceFile[FILEPATH_SIZE];      // Dsrc Application device file
}SS_DsrcAppDetectInfo;

// Structure that is available when SS_DEV_DETECT_USB_DSRC_CTRL_EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT_USB_DSRC_CTRL_EV is published.
 */
typedef struct _DsrcCtrlDetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL          bIsDeviceAvailable;             // Insert:TURE, Remove:FALSE
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo    usb_info;                       // USB Infomation
  /**
   * \~english Dsrc Control device file
   */
  int8_t        deviceFile[FILEPATH_SIZE];      // Dsrc Control device file
}SS_DsrcCtrlDetectInfo;

// Structure that is available when SS_DEV_DETECT_USB_IR_VICS_DATA_EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT_USB_IR_VICS_DATA_EV is published.
 */
typedef struct _IrVicsDataDetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL          bIsDeviceAvailable;             // Insert:TURE, Remove:FALSE
  /**
   * \~english USB Infomation
   */
  SS_UsbInfo    usb_info;                       // USB Infomation
  /**
   * \~english Ir Vics Data device file
   */
  int8_t        deviceFile[FILEPATH_SIZE];      // Ir Vics Data device file
}SS_IrVicsDataDetectInfo;

/**
 * \~english USB overcurrent error info.
 */
typedef  struct  _UsbOverCurrentErrInfo {
  /**
   * \~english error port no
   */
  uint8_t   portNo;    // error port no
} SS_UsbOverCurrentErrInfo;

// Structure that is available when SS_DEV_INFO_USB_NOTIFY_EV is published.
/**
 * \~english Structure that is available when SS_DEV_INFO_USB_NOTIFY_EV is published.
 */
typedef struct _UsbNotifyInfo {
  /**
   * \~english notify code
   */
  SS_NOTIFY_CODE  nofity_code;    // notify code
  /**
   * \~english USB device information's availability
   */
  BOOL      usb_info_availability;  // USB device information's availability
  /**
   * \~english USB device information
   */
  SS_UsbInfo    usb_info;    // USB device information
} SS_UsbNotifyInfo;

// Structure that is available when SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV is published.
/**
 * \~english Structure that is available when SS_DEV_DETECT_ANY_USB__CWORD57__ROLE_EV is published.
 */
typedef struct __CWORD57_RoleDetectInfo {
  /**
   * \~english Insert:TURE, Remove:FALSE
   */
  BOOL          bIsDeviceAvailable;             // Insert:TURE, Remove:FALSE
} SS__CWORD57_RoleDetectInfo;

// Structure that is available when SS_DEV_INFO_SD_FORMAT_COMP_EV is published.
/**
 * \~english Structure that is available when SS_DEV_INFO_SD_FORMAT_COMP_EV is published.
 */
typedef struct _SDFormatInfo {
  /**
   * \~english Result of SD Format.
   */
  SS_DEV_ERROR          result;             // Result of SD Format.
} SS_SDFormatInfo;

#endif /* _SS_DEVICEDETECTION_SERVER_H_ */  // NOLINT (build/header_guard)

/** @}*/  // end of device_detection_service
/** @}*/  // end of system_service
/** @}*/  // end of BaseSystem