@basmilius/apple-devices 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ export default class extends EventEmitter<EventMap> {
18
18
  get volume(): Volume;
19
19
  get timingServer(): TimingServer | undefined;
20
20
  set timingServer(timingServer: TimingServer | undefined);
21
- constructor(deviceId: string, discoveryResult: DiscoveryResult);
21
+ constructor(discoveryResult: DiscoveryResult);
22
22
  connect(): Promise<void>;
23
23
  disconnect(): Promise<void>;
24
24
  disconnectSafely(): Promise<void>;
@@ -11,7 +11,7 @@ export default class extends EventEmitter<EventMap> {
11
11
  get discoveryResult(): DiscoveryResult;
12
12
  set discoveryResult(discoveryResult: DiscoveryResult);
13
13
  get isConnected(): boolean;
14
- constructor(deviceId: string, discoveryResult: DiscoveryResult);
14
+ constructor(discoveryResult: DiscoveryResult);
15
15
  connect(): Promise<void>;
16
16
  disconnect(): Promise<void>;
17
17
  disconnectSafely(): Promise<void>;
package/dist/index.js CHANGED
@@ -1530,7 +1530,6 @@ class device_default extends EventEmitter2 {
1530
1530
  set timingServer(timingServer) {
1531
1531
  this.#timingServer = timingServer;
1532
1532
  }
1533
- #deviceId;
1534
1533
  #remote;
1535
1534
  #state;
1536
1535
  #volume;
@@ -1541,9 +1540,8 @@ class device_default extends EventEmitter2 {
1541
1540
  #keys;
1542
1541
  #protocol;
1543
1542
  #timingServer;
1544
- constructor(deviceId, discoveryResult) {
1543
+ constructor(discoveryResult) {
1545
1544
  super();
1546
- this.#deviceId = deviceId;
1547
1545
  this.#discoveryResult = discoveryResult;
1548
1546
  this.#remote = new remote_default(this);
1549
1547
  this.#state = new state_default(this);
@@ -1552,7 +1550,7 @@ class device_default extends EventEmitter2 {
1552
1550
  async connect() {
1553
1551
  this.#disconnect = false;
1554
1552
  this.#state.clear();
1555
- this.#protocol = new Protocol(this.#deviceId, this.#discoveryResult);
1553
+ this.#protocol = new Protocol(this.#discoveryResult);
1556
1554
  this.#protocol.controlStream.on("close", async () => this.#onClose());
1557
1555
  this.#protocol.controlStream.on("error", async (err) => this.#onError(err));
1558
1556
  this.#protocol.controlStream.on("timeout", async () => this.#onTimeout());
@@ -1679,16 +1677,14 @@ class device_default2 extends EventEmitter3 {
1679
1677
  get isConnected() {
1680
1678
  return this.#protocol?.stream?.isConnected ?? false;
1681
1679
  }
1682
- #deviceId;
1683
1680
  #credentials;
1684
1681
  #disconnect = false;
1685
1682
  #discoveryResult;
1686
1683
  #heartbeatInterval;
1687
1684
  #keys;
1688
1685
  #protocol;
1689
- constructor(deviceId, discoveryResult) {
1686
+ constructor(discoveryResult) {
1690
1687
  super();
1691
- this.#deviceId = deviceId;
1692
1688
  this.#discoveryResult = discoveryResult;
1693
1689
  this.onSystemStatus = this.onSystemStatus.bind(this);
1694
1690
  this.onTVSystemStatus = this.onTVSystemStatus.bind(this);
@@ -1698,7 +1694,7 @@ class device_default2 extends EventEmitter3 {
1698
1694
  throw new Error("Credentials are required to connect to a Companion Link device.");
1699
1695
  }
1700
1696
  this.#disconnect = false;
1701
- this.#protocol = new Protocol2(this.#deviceId, this.#discoveryResult);
1697
+ this.#protocol = new Protocol2(this.#discoveryResult);
1702
1698
  this.#protocol.stream.on("close", async () => this.#onClose());
1703
1699
  this.#protocol.stream.on("error", async (err) => this.#onError(err));
1704
1700
  this.#protocol.stream.on("timeout", async () => this.#onTimeout());
@@ -1814,9 +1810,6 @@ class apple_tv_default extends EventEmitter4 {
1814
1810
  get bundleIdentifier() {
1815
1811
  return this.#airplay.state.nowPlayingClient?.bundleIdentifier ?? null;
1816
1812
  }
1817
- get deviceId() {
1818
- return this.#deviceId;
1819
- }
1820
1813
  get displayName() {
1821
1814
  return this.#airplay.state.nowPlayingClient?.displayName ?? null;
1822
1815
  }
@@ -1837,13 +1830,11 @@ class apple_tv_default extends EventEmitter4 {
1837
1830
  }
1838
1831
  #airplay;
1839
1832
  #companionLink;
1840
- #deviceId;
1841
1833
  #disconnect = false;
1842
- constructor(deviceId, airplayDiscoveryResult, companionLinkDiscoveryResult) {
1834
+ constructor(airplayDiscoveryResult, companionLinkDiscoveryResult) {
1843
1835
  super();
1844
- this.#deviceId = deviceId;
1845
- this.#airplay = new device_default(this.#deviceId, airplayDiscoveryResult);
1846
- this.#companionLink = new device_default2(this.#deviceId, companionLinkDiscoveryResult);
1836
+ this.#airplay = new device_default(airplayDiscoveryResult);
1837
+ this.#companionLink = new device_default2(companionLinkDiscoveryResult);
1847
1838
  this.#airplay.on("connected", () => this.#onConnected());
1848
1839
  this.#airplay.on("disconnected", (unexpected) => this.#onDisconnected(unexpected));
1849
1840
  this.#companionLink.on("connected", () => this.#onConnected());
@@ -1932,9 +1923,6 @@ class homepod_base_default extends EventEmitter5 {
1932
1923
  get bundleIdentifier() {
1933
1924
  return this.#airplay.state.nowPlayingClient?.bundleIdentifier ?? null;
1934
1925
  }
1935
- get deviceId() {
1936
- return this.#deviceId;
1937
- }
1938
1926
  get displayName() {
1939
1927
  return this.#airplay.state.nowPlayingClient?.displayName ?? null;
1940
1928
  }
@@ -1957,12 +1945,10 @@ class homepod_base_default extends EventEmitter5 {
1957
1945
  return this.#airplay.state.volume ?? 0;
1958
1946
  }
1959
1947
  #airplay;
1960
- #deviceId;
1961
1948
  #disconnect = false;
1962
- constructor(deviceId, discoveryResult) {
1949
+ constructor(discoveryResult) {
1963
1950
  super();
1964
- this.#deviceId = deviceId;
1965
- this.#airplay = new device_default(this.#deviceId, discoveryResult);
1951
+ this.#airplay = new device_default(discoveryResult);
1966
1952
  this.#airplay.on("connected", () => this.#onConnected());
1967
1953
  this.#airplay.on("disconnected", (unexpected) => this.#onDisconnected(unexpected));
1968
1954
  }
@@ -12,14 +12,13 @@ export default class extends EventEmitter<EventMap> {
12
12
  get airplay(): AirPlayDevice;
13
13
  get companionLink(): CompanionLinkDevice;
14
14
  get bundleIdentifier(): string | null;
15
- get deviceId(): string;
16
15
  get displayName(): string | null;
17
16
  get isConnected(): boolean;
18
17
  get isPlaying(): boolean;
19
18
  get playbackQueue(): AirPlay.Proto.PlaybackQueue | null;
20
19
  get playbackState(): AirPlay.Proto.PlaybackState_Enum;
21
20
  get playbackStateTimestamp(): number;
22
- constructor(deviceId: string, airplayDiscoveryResult: DiscoveryResult, companionLinkDiscoveryResult: DiscoveryResult);
21
+ constructor(airplayDiscoveryResult: DiscoveryResult, companionLinkDiscoveryResult: DiscoveryResult);
23
22
  connect(credentials: AccessoryCredentials): Promise<void>;
24
23
  disconnect(): Promise<void>;
25
24
  turnOff(): Promise<void>;
@@ -10,7 +10,6 @@ export default abstract class extends EventEmitter<EventMap> {
10
10
  #private;
11
11
  get airplay(): AirPlayDevice;
12
12
  get bundleIdentifier(): string | null;
13
- get deviceId(): string;
14
13
  get displayName(): string | null;
15
14
  get isConnected(): boolean;
16
15
  get isPlaying(): boolean;
@@ -18,7 +17,7 @@ export default abstract class extends EventEmitter<EventMap> {
18
17
  get playbackState(): AirPlay.Proto.PlaybackState_Enum;
19
18
  get playbackStateTimestamp(): number;
20
19
  get volume(): number;
21
- constructor(deviceId: string, discoveryResult: DiscoveryResult);
20
+ constructor(discoveryResult: DiscoveryResult);
22
21
  connect(): Promise<void>;
23
22
  disconnect(): Promise<void>;
24
23
  pause(): Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@basmilius/apple-devices",
3
3
  "description": "Exposes various Apple devices to connect with either AirPlay or Companion Link.",
4
- "version": "0.4.2",
4
+ "version": "0.5.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -43,10 +43,10 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@basmilius/apple-airplay": "0.4.2",
47
- "@basmilius/apple-common": "0.4.2",
48
- "@basmilius/apple-companion-link": "0.4.2",
49
- "@basmilius/apple-encoding": "0.4.2"
46
+ "@basmilius/apple-airplay": "0.5.0",
47
+ "@basmilius/apple-common": "0.5.0",
48
+ "@basmilius/apple-companion-link": "0.5.0",
49
+ "@basmilius/apple-encoding": "0.5.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@basmilius/tools": "^2.23.0",