phystack-hub-client 0.2.0__py3-none-any.whl

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.
@@ -0,0 +1,90 @@
1
+ """
2
+ Phystack Hub Client - Python implementation
3
+
4
+ A Python client for PhyHub that provides:
5
+ - Events and Actions via twin messaging
6
+ - WebRTC DataChannel for P2P data
7
+ - WebRTC MediaStream for P2P video/audio
8
+ - Twin instance management (Edge, Peripheral, etc.)
9
+ - Properties API (reported/desired)
10
+ - Settings API with subscriptions
11
+
12
+ Usage:
13
+ from phystack.hub_client import PhyHubClient
14
+
15
+ async with PhyHubClient.from_env() as client:
16
+ instance = await client.get_instance()
17
+
18
+ # Events
19
+ instance.on("my-event", lambda data, respond: print(data))
20
+ instance.to(peer_twin_id).emit("my-event", {"hello": "world"})
21
+
22
+ # Actions (request-response)
23
+ instance.to(peer_twin_id).emit("my-action", {"cmd": "process"}, callback=my_callback)
24
+
25
+ # Properties
26
+ await instance.update_reported({"status": "ready"})
27
+ instance.on_update_desired(lambda props: print("Desired changed:", props))
28
+
29
+ # Settings (for edge apps)
30
+ settings = client.get_settings()
31
+ client.on_settings_update(lambda s: print("Settings updated:", s))
32
+
33
+ # DataChannel
34
+ dc = await instance.get_data_channel(peer_twin_id)
35
+ dc.send({"message": "hello"})
36
+
37
+ # MediaStream (with webcam)
38
+ stream = await instance.get_media_stream(peer_twin_id)
39
+ """
40
+
41
+ from phystack.hub_client.client import PhyHubClient
42
+ from phystack.hub_client.types.twin_types import (
43
+ TwinMessageResult,
44
+ TwinMessageResultStatus,
45
+ TwinProperties,
46
+ TwinTypeEnum,
47
+ TwinStatusEnum,
48
+ )
49
+ from phystack.hub_client.instances import (
50
+ BaseInstance,
51
+ EdgeInstance,
52
+ PeripheralInstance,
53
+ )
54
+ from phystack.hub_client.twin_registry import TwinRegistry
55
+ from phystack.hub_client.services.webrtc.data_channel import (
56
+ DataChannelHandler,
57
+ DataChannelOptions,
58
+ PhygridDataChannel,
59
+ )
60
+ from phystack.hub_client.services.webrtc.media_stream import (
61
+ MediaStreamHandler,
62
+ MediaStreamOptions,
63
+ PhygridMediaStream,
64
+ WebcamVideoTrack,
65
+ )
66
+
67
+ __version__ = "0.1.0"
68
+ __all__ = [
69
+ # Client
70
+ "PhyHubClient",
71
+ # Instances
72
+ "BaseInstance",
73
+ "EdgeInstance",
74
+ "PeripheralInstance",
75
+ "TwinRegistry",
76
+ # Types
77
+ "TwinMessageResult",
78
+ "TwinMessageResultStatus",
79
+ "TwinProperties",
80
+ "TwinTypeEnum",
81
+ "TwinStatusEnum",
82
+ # WebRTC
83
+ "DataChannelHandler",
84
+ "DataChannelOptions",
85
+ "PhygridDataChannel",
86
+ "MediaStreamHandler",
87
+ "MediaStreamOptions",
88
+ "PhygridMediaStream",
89
+ "WebcamVideoTrack",
90
+ ]