mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Docs: icsneopy: Add TC10 example
This commit is contained in:
@@ -88,3 +88,43 @@ Monitor Ethernet Status
|
||||
time.sleep(1)
|
||||
|
||||
main()
|
||||
|
||||
TC10
|
||||
====
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import icsneopy
|
||||
import time
|
||||
|
||||
devices: list[icsneopy.Device] = icsneopy.find_all_devices()
|
||||
|
||||
device: icsneopy.Device = devices[0]
|
||||
|
||||
print(f"using {device} for TC10")
|
||||
|
||||
device.open()
|
||||
|
||||
netid = icsneopy.Network.NetID.OP_Ethernet1
|
||||
|
||||
if device.supports_tc10():
|
||||
# initial
|
||||
status = device.get_tc10_status(netid)
|
||||
print(f"initial status: wake: {status.wakeStatus}, sleep: {status.sleepStatus}")
|
||||
time.sleep(1)
|
||||
|
||||
# sleep
|
||||
device.request_tc10_sleep(netid)
|
||||
print("waiting 1s for sleep to occur")
|
||||
time.sleep(1)
|
||||
status = device.get_tc10_status(netid)
|
||||
print(f"post sleep status: wake: {status.wakeStatus}, sleep: {status.sleepStatus}")
|
||||
|
||||
# wake
|
||||
device.request_tc10_wake(netid)
|
||||
print("waiting 1s for wake to occur")
|
||||
time.sleep(1)
|
||||
status = device.get_tc10_status(netid)
|
||||
print(f"post wake status: wake: {status.wakeStatus}, sleep: {status.sleepStatus}")
|
||||
else:
|
||||
print(f"{device} does not support TC10")
|
||||
|
||||
Reference in New Issue
Block a user