You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 2, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+86-31
Original file line number
Diff line number
Diff line change
@@ -117,7 +117,7 @@ Usage
117
117
In order to use mobile-cli-lib, just add a reference to it in your package.json:
118
118
```JSON
119
119
dependencies: {
120
-
"mobile-cli-lib": "0.0.4"
120
+
"mobile-cli-lib": "0.4.0"
121
121
}
122
122
```
123
123
@@ -144,51 +144,103 @@ You can change the filename in `index.js`.
144
144
Public API
145
145
==
146
146
147
-
This section contains information about each public method. All methods return Promise.
147
+
This section contains information about each public method.
148
148
149
-
### Module deviceEmitter
150
-
> Stability 2 - Stable
151
-
152
-
`deviceEmitter` module is used to emit different events related to devices attached to the system.
153
-
You can use `deviceEmitter` to add handles for the following events:
154
-
155
-
*`deviceFound` - Raised when a new device is attached to the system. The callback function will receive one argument - deviceInfoData. It contains the following information:
149
+
Device related public API, exposes `IDeviceInfo` data, that contains the following information:
156
150
```TypeScript
151
+
/**
152
+
* Describes available information for a device.
153
+
*/
157
154
interfaceIDeviceInfo {
155
+
/**
156
+
* Unique identifier of the device.
157
+
*/
158
158
identifier:string;
159
+
160
+
/**
161
+
* The name of the device.
162
+
* For Android this is the value of device's 'ro.product.name' property.
163
+
* For iOS this is the value of device's 'DeviceName' property.
164
+
*/
159
165
displayName:string;
166
+
167
+
/**
168
+
* Device model.
169
+
* For Android this is the value of device's 'ro.product.model' property.
170
+
* For iOS this is the value of device's 'ProductType' property.
171
+
*/
160
172
model:string;
173
+
174
+
/**
175
+
* Version of the OS.
176
+
* For Android this is the value of device's 'ro.build.version.release' property.
177
+
* For iOS this is the value of device's 'ProductVersion' property.
178
+
*/
161
179
version:string;
180
+
181
+
/**
182
+
* Vendor of the device.
183
+
* For Android this is the value of device's 'ro.product.brand' property.
184
+
* For iOS the value is always "Apple".
185
+
*/
162
186
vendor:string;
187
+
188
+
/**
189
+
* Device's platform.
190
+
* Can be Android or iOS.
191
+
*/
163
192
platform:string;
193
+
194
+
/**
195
+
* Status of device describing if you can work with this device or there's communication error.
196
+
* Can be Connected or Unreachable.
197
+
*/
198
+
status:string;
199
+
200
+
/**
201
+
* Additional information for errors that prevents working with this device.
202
+
* It will be null when status is Connected.
203
+
*/
204
+
errorHelp:string;
205
+
206
+
/**
207
+
* Defines if the device is tablet or not.
208
+
* For Android the value will be true when device's 'ro.build.characteristics' property contains "tablet" word or when the 'ro.build.version.release' is 3.x
209
+
* For iOS the value will be true when device's 'ProductType' property contains "ipad" word.
210
+
*/
211
+
isTablet:boolean;
212
+
213
+
/**
214
+
* Optional property describing the color of the device.
215
+
* Available for iOS only - the value of device's 'DeviceColor' property.
216
+
*/
217
+
color?:string;
164
218
}
165
219
```
220
+
221
+
### Module deviceEmitter
222
+
> Stability 2 - Stable
223
+
224
+
`deviceEmitter` module is used to emit different events related to devices attached to the system.
225
+
You can use `deviceEmitter` to add handles for the following events:
226
+
227
+
*`deviceFound` - Raised when a new device is attached to the system. The callback function will receive one argument - deviceInfoData.
console.log("Found device with identifier: "+deviceInfoData.identifier);
170
232
});
171
233
```
172
234
173
-
*`deviceLost` - Raised when a device is detached from the system. The callback function will receive one argument - deviceInfoData. It contains the following information:
174
-
```TypeScript
175
-
interfaceIDeviceInfo {
176
-
identifier:string;
177
-
displayName:string;
178
-
model:string;
179
-
version:string;
180
-
vendor:string;
181
-
platform:string;
182
-
}
183
-
```
235
+
*`deviceLost` - Raised when a device is detached from the system. The callback function will receive one argument - deviceInfoData.
console.log("Detached device with identifier: "+deviceInfoData.identifier);
188
240
});
189
241
```
190
242
191
-
*`deviceLogData` - Raised when attached device sends reports any information. This is the output of `adb logcat` for Android devices. For iOS this si the `iOS SysLog`.
243
+
*`deviceLogData` - Raised when attached device sends reports any information. This is the output of `adb logcat` for Android devices. For iOS this is the `iOS SysLog`.
192
244
The event is raised for any device that reports data. The callback function has two arguments - `deviceIdentifier` and `reportedData`. <br/><br/>
*`setLogLevel(logLevel: string, deviceIdentifier?: string)` - Sets the logging level for device(s) to `INFO` or `FULL`.
286
+
The method has two parameters, only the first one is mandatory. When only `logLevel` is passed, it's value is used for all currently connected devices and all devices that will be connected in the future.
287
+
By default the logging level is set to `INFO`. For example when there are two devices attached and this method is called in the following way:
Everything that the devices report will be raised in `deviceEmitter.deviceLogData` event. When a new device is attached, all of the information that it reports will also be send.
292
+
When the `deviceIdentifier` is passed, the value of the log level will be used only for this device. For example when all devices report all of their logs (`FULL`) level, you may call:
Copy file name to clipboardExpand all lines: definitions/mobile.d.ts
+56
Original file line number
Diff line number
Diff line change
@@ -6,16 +6,72 @@ declare module Mobile {
6
6
skipRefresh?: boolean;
7
7
}
8
8
9
+
/**
10
+
* Describes available information for a device.
11
+
*/
9
12
interfaceIDeviceInfo{
13
+
/**
14
+
* Unique identifier of the device.
15
+
*/
10
16
identifier: string;
17
+
18
+
/**
19
+
* The name of the device.
20
+
* For Android this is the value of device's 'ro.product.name' property.
21
+
* For iOS this is the value of device's 'DeviceName' property.
22
+
*/
11
23
displayName: string;
24
+
25
+
/**
26
+
* Device model.
27
+
* For Android this is the value of device's 'ro.product.model' property.
28
+
* For iOS this is the value of device's 'ProductType' property.
29
+
*/
12
30
model: string;
31
+
32
+
/**
33
+
* Version of the OS.
34
+
* For Android this is the value of device's 'ro.build.version.release' property.
35
+
* For iOS this is the value of device's 'ProductVersion' property.
36
+
*/
13
37
version: string;
38
+
39
+
/**
40
+
* Vendor of the device.
41
+
* For Android this is the value of device's 'ro.product.brand' property.
42
+
* For iOS the value is always "Apple".
43
+
*/
14
44
vendor: string;
45
+
46
+
/**
47
+
* Device's platform.
48
+
* Can be Android or iOS.
49
+
*/
15
50
platform: string;
51
+
52
+
/**
53
+
* Status of device describing if you can work with this device or there's communication error.
54
+
* Can be Connected or Unauthorized.
55
+
*/
16
56
status: string;
57
+
58
+
/**
59
+
* Additional information for errors that prevents working with this device.
60
+
* It will be null when status is Connected.
61
+
*/
17
62
errorHelp: string;
63
+
64
+
/**
65
+
* Defines if the device is tablet or not.
66
+
* For Android the value will be true when device's 'ro.build.characteristics' property contains "tablet" word or when the 'ro.build.version.release' is 3.x
67
+
* For iOS the value will be true when device's 'ProductType' property contains "ipad" word.
68
+
*/
18
69
isTablet: boolean;
70
+
71
+
/**
72
+
* Optional property describing the color of the device.
73
+
* Available for iOS only - the value of device's 'DeviceColor' property.
0 commit comments