-
Notifications
You must be signed in to change notification settings - Fork 22
Add support for detecting ecpNetworkAccessMode #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
87b392e
530f651
f0bab23
22d6a1c
410a8f5
f64696b
483568c
d591672
3a8d276
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1196,10 +1196,18 @@ export class RokuDeploy { | |
|
|
||
| const url = `http://${options.host}:${options.remotePort}/query/device-info`; | ||
|
|
||
| let response = await this.doGetRequest({ | ||
| url: url, | ||
| timeout: options.timeout | ||
| }); | ||
| let response; | ||
| try { | ||
| response = await this.doGetRequest({ | ||
| url: url, | ||
| timeout: options.timeout | ||
| }); | ||
| } catch (e) { | ||
| if ((e as any)?.results?.response?.headers.server?.includes('Roku')) { | ||
| throw new errors.ECPSettingModeDisabledError('ECP Device Info request failed. ECP setting mode is disabled.', response); | ||
|
||
| } | ||
| throw e; | ||
| } | ||
| try { | ||
| const parsedContent = await xml2js.parseStringPromise(response.body, { | ||
| explicitArray: false | ||
|
|
@@ -1223,6 +1231,30 @@ export class RokuDeploy { | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Get the External Control Protocol (ECP) setting mode of the device. This determines whether | ||
| * the device accepts remote control commands via the ECP API. | ||
| * | ||
| * @param options - Configuration options including host, remotePort, timeout, etc. | ||
| * @returns The ECP setting mode: | ||
| * - 'enabled': fully enabled and accepting commands | ||
| * - 'disabled': ECP is disabled (device may still be reachable but ECP commands won't work) | ||
| * - 'limited': Restricted functionality, text and movement commands only | ||
| * - 'permissive': Full access for internal networks | ||
| */ | ||
| public async getECPSetting(options: GetDeviceInfoOptions): Promise<'enabled' | 'disabled' | 'limited' | 'permissive'> { | ||
|
||
| try { | ||
| const deviceInfo = await this.getDeviceInfo(options); | ||
| return deviceInfo.ecpSettingMode; | ||
| } catch (e) { | ||
| if ((e as any)?.results?.response?.headers.server?.includes('Roku')) { | ||
| return 'disabled'; | ||
| } | ||
| throw new errors.UnknownDeviceResponseError('Could not retrieve device ECP setting'); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| /** | ||
| * Normalize a deviceInfo field value. This includes things like converting boolean strings to booleans, number strings to numbers, | ||
| * decoding HtmlEntities, etc. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align with the new term
ecpNetworkAccessMode