|
18 | 18 | */
|
19 | 19 |
|
20 | 20 | #pragma once
|
21 |
| - |
| 21 | + |
22 | 22 | #include "Module.h"
|
23 | 23 |
|
24 | 24 | // @stubgen:include <com/IIteratorType.h>
|
25 |
| - |
| 25 | + |
26 | 26 | namespace WPEFramework {
|
27 | 27 | namespace Exchange {
|
28 |
| -// @json @text:keep |
| 28 | +/* @json 1.0.0 @text:keep */ |
29 | 29 | struct EXTERNAL IUSBDevice : virtual public Core::IUnknown {
|
30 |
| - enum { ID = ID_USB_DEVICE }; |
31 |
| - |
32 |
| - struct USBDevice { |
33 |
| - uint8_t deviceClass /* @brief USB class of the device as per USB specificiation */ ; |
34 |
| - uint8_t deviceSubclass /* @brief USB sub class of the device as per USB specificiation */; |
35 |
| - string deviceName /* @brief Name of the USB device */; |
36 |
| - string devicePath /* @brief the path to be used for the USB device ex: /dev/sdX */; |
37 |
| - }; |
38 |
| - using IUSBDeviceIterator = RPC::IIteratorType<USBDevice, ID_USB_DEVICE_ITERATOR>; |
39 |
| - // @event |
40 |
| - struct EXTERNAL INotification : virtual public Core::IUnknown { |
| 30 | + enum { ID = ID_USB_DEVICE }; |
| 31 | + |
| 32 | + struct USBDevice { |
| 33 | + uint8_t deviceClass /* @brief USB class of the device as per USB specificiation */ ; |
| 34 | + uint8_t deviceSubclass /* @brief USB sub class of the device as per USB specificiation */; |
| 35 | + string deviceName /* @brief Name of the USB device */; |
| 36 | + string devicePath /* @brief the path to be used for the USB device ex: /dev/sdX */; |
| 37 | + }; |
| 38 | + using IUSBDeviceIterator = RPC::IIteratorType<USBDevice, ID_USB_DEVICE_ITERATOR>; |
| 39 | + // @event |
| 40 | + struct EXTERNAL INotification : virtual public Core::IUnknown { |
41 | 41 | enum { ID = ID_USB_DEVICE_NOTIFICATION };
|
42 |
| - |
| 42 | + |
43 | 43 | // @brief Device Plugged in notification
|
44 | 44 | // @text onDevicePluggedIn
|
45 | 45 | // @param USBDevice: USB information of the plugged in device
|
46 |
| - virtual void OnDevicePluggedIn(const USBDevice &device) = 0; |
| 46 | + virtual void OnDevicePluggedIn(const USBDevice &device) {}; |
47 | 47 |
|
48 | 48 | // @brief Device Plugged out notification
|
49 | 49 | // @text onDevicePluggedOut
|
50 | 50 | // @param USBDevice: USB information of the plugged in device
|
51 |
| - virtual void OnDevicePluggedOut(const USBDevice &device) = 0; |
52 |
| - |
53 |
| - }; |
54 |
| - |
55 |
| - /** Register notification interface */ |
56 |
| - virtual uint32_t Register(Exchange::IUSBDevice::INotification *notification) = 0; |
57 |
| - /** Unregister notification interface */ |
58 |
| - virtual uint32_t Unregister(Exchange::IUSBDevice::INotification *notification) = 0; |
59 |
| - |
60 |
| - struct USBProductInfo { |
61 |
| - uint16_t languageId /* @brief language id present on the device */; |
62 |
| - string serialNumber /* @brief unicode string representing the serial number of the device */; |
63 |
| - string manufacturer /* @brief unicode string representing the manufacturer of the device */; |
64 |
| - string product /* @brief unicode string representing the product */; |
65 |
| - }; |
66 |
| - using IUSBProductInfoIterator = RPC::IIteratorType<USBProductInfo, ID_USB_PRODUCT_INFO_ITERATOR>; |
67 |
| - |
68 |
| - enum USBDeviceSpeed : uint8_t { |
69 |
| - DEVICE_SPEED_LOW = 1 /* @text Low */, |
70 |
| - DEVICE_SPEED_FULL = 2 /* @text Full */, |
71 |
| - DEVICE_SPEED_HIGH = 3 /* @text High */, |
72 |
| - DEVICE_SPEED_SUPER = 4 /* @text Super */ |
73 |
| - }; |
74 |
| - |
75 |
| - enum USBDeviceFlags : uint8_t { |
76 |
| - DEVICE_FLAGS_DRIVER_AVAILABLE = 1 /* @text AVAILABLE */, |
77 |
| - DEVICE_FLAGS_SWITCHABLE = 2 /* @text SWITCHABLE */ |
78 |
| - }; |
79 |
| - |
80 |
| - enum USBDeviceStatus : uint8_t { |
81 |
| - DEVICE_STATUS_ACTIVE = 0x01 /* @text Active */, |
82 |
| - DEVICE_STATUS_NO_DEVICE_CONNECTED = 0x02 /* @text NoDeviceConnected*/, |
83 |
| - DEVICE_STATUS_SELF_POWERED = 0x04 /* @text SelfPowered */ |
84 |
| - }; |
85 |
| - |
86 |
| - struct USBDeviceInfo { |
87 |
| - uint32_t parentId /* @brief Parent Node ID of the device */; |
88 |
| - uint8_t deviceStatus /* @bitmask current device status */; |
89 |
| - uint8_t deviceLevel /* @brief device level */; |
90 |
| - uint8_t portNumber /* @brief port number of USB on which the device is attached */; |
91 |
| - uint16_t vendorId /* @brief Vendor ID of the device */; |
92 |
| - uint16_t productId /* @brief Product ID of the device */; |
93 |
| - uint8_t protocol /* @brief Protocol supported by the device */; |
94 |
| - string serialNumber /* @brief Serial number of the device */; |
95 |
| - USBDevice device /* @brief Basic device information included */; |
96 |
| - USBDeviceFlags flags /* @brief Flags of the device */; |
97 |
| - uint32_t features /* @brief Features supported by the device - reserved */; |
98 |
| - USBDeviceSpeed busSpeed /* @brief Speed of the device */; |
99 |
| - uint8_t numLanguageIds /* @brief number of language ids present on the device */; |
100 |
| - USBProductInfo productInfo1; |
101 |
| - USBProductInfo productInfo2; |
102 |
| - USBProductInfo productInfo3; |
103 |
| - USBProductInfo productInfo4; |
104 |
| - }; |
105 |
| - using IUSBDeviceInfoIterator = RPC::IIteratorType<USBDeviceInfo, ID_USB_DEVICE_INFO_ITERATOR>; |
106 |
| - |
107 |
| - /** Gets the device information of the connected USB Devices.*/ |
108 |
| - // @text getDeviceList |
109 |
| - // @brief Get the basic information about list of devices connected with the system. |
110 |
| - // @param devices : List of USB devices along with basic info. |
111 |
| - virtual uint32_t GetDeviceList(IUSBDeviceIterator*& devices /* @out */ ) const = 0; |
112 |
| - |
113 |
| - /** Gets detailed device information for the given device name */ |
114 |
| - // @text getDeviceInfo |
115 |
| - // @brief Get the extended USB device information for the provided device name |
116 |
| - // @param deviceName: device name |
117 |
| - // @param deviceInfo: Detailed device information |
118 |
| - virtual uint32_t GetDeviceInfo(const string &deviceName /* @in @text deviceName */, IUSBDeviceInfoIterator*& deviceInfo /* @out */) const = 0; |
119 |
| - |
120 |
| - /** Binds the respective driver for the device */ |
121 |
| - // @text bindDriver |
122 |
| - // @brief Bind the respective driver for the device */ |
123 |
| - // @param deviceName: Name of the device |
124 |
| - virtual uint32_t BindDriver(const string &deviceName /* @in @text deviceName */) const = 0; |
125 |
| - |
126 |
| - /** Unbinds the respective driver for the device */ |
127 |
| - // @text unbindDriver |
128 |
| - // @brief Unbind the respective driver for the device */ |
129 |
| - // @param deviceName: Name of the device |
130 |
| - virtual uint32_t UnbindDriver(const string &deviceName /* @in @text deviceName */) const = 0; |
| 51 | + virtual void OnDevicePluggedOut(const USBDevice &device) {}; |
| 52 | + |
| 53 | + }; |
| 54 | + |
| 55 | + /** Register notification interface */ |
| 56 | + virtual Core::hresult Register(Exchange::IUSBDevice::INotification *notification) = 0; |
| 57 | + /** Unregister notification interface */ |
| 58 | + virtual Core::hresult Unregister(Exchange::IUSBDevice::INotification *notification) = 0; |
| 59 | + |
| 60 | + struct USBProductInfo { |
| 61 | + uint16_t languageId /* @brief language id present on the device */; |
| 62 | + string serialNumber /* @brief unicode string representing the serial number of the device */; |
| 63 | + string manufacturer /* @brief unicode string representing the manufacturer of the device */; |
| 64 | + string product /* @brief unicode string representing the product */; |
| 65 | + }; |
| 66 | + using IUSBProductInfoIterator = RPC::IIteratorType<USBProductInfo, ID_USB_PRODUCT_INFO_ITERATOR>; |
| 67 | + |
| 68 | + enum USBDeviceSpeed : uint8_t { |
| 69 | + DEVICE_SPEED_LOW = 1 /* @text Low */, |
| 70 | + DEVICE_SPEED_FULL = 2 /* @text Full */, |
| 71 | + DEVICE_SPEED_HIGH = 3 /* @text High */, |
| 72 | + DEVICE_SPEED_SUPER = 4 /* @text Super */ |
| 73 | + }; |
| 74 | + |
| 75 | + enum USBDeviceFlags : uint8_t { |
| 76 | + DEVICE_FLAGS_DRIVER_AVAILABLE = 1 /* @text AVAILABLE */, |
| 77 | + DEVICE_FLAGS_SWITCHABLE = 2 /* @text SWITCHABLE */ |
| 78 | + }; |
| 79 | + |
| 80 | + enum USBDeviceStatus : uint8_t { |
| 81 | + DEVICE_STATUS_ACTIVE = 0x01 /* @text Active */, |
| 82 | + DEVICE_STATUS_NO_DEVICE_CONNECTED = 0x02 /* @text NoDeviceConnected*/, |
| 83 | + DEVICE_STATUS_SELF_POWERED = 0x04 /* @text SelfPowered */ |
| 84 | + }; |
| 85 | + |
| 86 | + struct USBDeviceInfo { |
| 87 | + uint32_t parentId /* @brief Parent Node ID of the device */; |
| 88 | + uint8_t deviceStatus /* @bitmask current device status */; |
| 89 | + uint8_t deviceLevel /* @brief device level */; |
| 90 | + uint8_t portNumber /* @brief port number of USB on which the device is attached */; |
| 91 | + uint16_t vendorId /* @brief Vendor ID of the device */; |
| 92 | + uint16_t productId /* @brief Product ID of the device */; |
| 93 | + uint8_t protocol /* @brief Protocol supported by the device */; |
| 94 | + string serialNumber /* @brief Serial number of the device */; |
| 95 | + USBDevice device /* @brief Basic device information included */; |
| 96 | + USBDeviceFlags flags /* @brief Flags of the device */; |
| 97 | + uint32_t features /* @brief Features supported by the device - reserved */; |
| 98 | + USBDeviceSpeed busSpeed /* @brief Speed of the device */; |
| 99 | + uint8_t numLanguageIds /* @brief number of language ids present on the device */; |
| 100 | + USBProductInfo productInfo1; |
| 101 | + USBProductInfo productInfo2; |
| 102 | + USBProductInfo productInfo3; |
| 103 | + USBProductInfo productInfo4; |
| 104 | + }; |
| 105 | + using IUSBDeviceInfoIterator = RPC::IIteratorType<USBDeviceInfo, ID_USB_DEVICE_INFO_ITERATOR>; |
| 106 | + |
| 107 | + /** Gets the device information of the connected USB Devices.*/ |
| 108 | + // @text getDeviceList |
| 109 | + // @brief Get the basic information about list of devices connected with the system. |
| 110 | + // @param devices : List of USB devices along with basic info. |
| 111 | + virtual Core::hresult GetDeviceList(IUSBDeviceIterator*& devices /* @out */ ) const = 0; |
| 112 | + |
| 113 | + /** Gets detailed device information for the given device name */ |
| 114 | + // @text getDeviceInfo |
| 115 | + // @brief Get the extended USB device information for the provided device name |
| 116 | + // @param deviceName: device name |
| 117 | + // @param deviceInfo: Detailed device information |
| 118 | + virtual Core::hresult GetDeviceInfo(const string &deviceName /* @in @text deviceName */, USBDeviceInfo& deviceInfo /* @out */) const = 0; |
| 119 | + |
| 120 | + /** Binds the respective driver for the device */ |
| 121 | + // @text bindDriver |
| 122 | + // @brief Bind the respective driver for the device |
| 123 | + // @param deviceName: Name of the device |
| 124 | + virtual Core::hresult BindDriver(const string &deviceName /* @in @text deviceName */) const = 0; |
| 125 | + |
| 126 | + /** Unbinds the respective driver for the device */ |
| 127 | + // @text unbindDriver |
| 128 | + // @brief Unbind the respective driver for the device |
| 129 | + // @param deviceName: Name of the device |
| 130 | + virtual Core::hresult UnbindDriver(const string &deviceName /* @in @text deviceName */) const = 0; |
131 | 131 | };
|
132 |
| - |
| 132 | + |
133 | 133 | } // namespace Exchange
|
134 | 134 | } // namespace WPEFramework
|
0 commit comments