Skip to content

Commit

Permalink
Add select key.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Aug 4, 2018
1 parent 4ade100 commit 3b5dc83
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions dist/lib/appletv.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export declare module AppleTV {
Next = 7,
Previous = 8,
Suspend = 9,
Select = 10,
}
/** Convert a string representation of a key to the correct enum type.
* @param string The string.
Expand Down
6 changes: 6 additions & 0 deletions dist/lib/appletv.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ class AppleTV extends typed_events_1.default {
return this.sendKeyPressAndRelease(12, 0xB6);
case AppleTV.Key.Suspend:
return this.sendKeyPressAndRelease(1, 0x82);
case AppleTV.Key.Select:
return this.sendKeyPressAndRelease(1, 0x89);
}
}
sendKeyPressAndRelease(usePage, usage) {
Expand Down Expand Up @@ -321,6 +323,7 @@ exports.AppleTV = AppleTV;
Key[Key["Next"] = 7] = "Next";
Key[Key["Previous"] = 8] = "Previous";
Key[Key["Suspend"] = 9] = "Suspend";
Key[Key["Select"] = 10] = "Select";
})(Key = AppleTV.Key || (AppleTV.Key = {}));
/** Convert a string representation of a key to the correct enum type.
* @param string The string.
Expand Down Expand Up @@ -357,6 +360,9 @@ exports.AppleTV = AppleTV;
else if (string == "suspend") {
return AppleTV.Key.Suspend;
}
else if (string == "select") {
return AppleTV.Key.Select;
}
}
AppleTV.key = key;
})(AppleTV = exports.AppleTV || (exports.AppleTV = {}));
9 changes: 7 additions & 2 deletions src/lib/appletv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ export class AppleTV extends TypedEventEmitter<AppleTV.Events> {
return this.sendKeyPressAndRelease(12, 0xB6);
case AppleTV.Key.Suspend:
return this.sendKeyPressAndRelease(1, 0x82);
case AppleTV.Key.Select:
return this.sendKeyPressAndRelease(1, 0x89);
}
}

Expand Down Expand Up @@ -386,7 +388,8 @@ export module AppleTV {
Pause,
Next,
Previous,
Suspend
Suspend,
Select
}

/** Convert a string representation of a key to the correct enum type.
Expand Down Expand Up @@ -414,6 +417,8 @@ export module AppleTV {
return AppleTV.Key.Previous;
} else if (string == "suspend") {
return AppleTV.Key.Suspend;
} else if (string == "select") {
return AppleTV.Key.Select;
}
}
}
}

0 comments on commit 3b5dc83

Please sign in to comment.