You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

example3.py 2.7KB

  1. from pms_api import SixfabPMS, Definition
  2. import time
  3. pms = SixfabPMS()
  4. epoch = time.time()
  5. #print("Epoch Time: " + str(int(epoch)))
  6. # RTC
  7. print("RTC: " + str(pms.setRtcTime(int(epoch), 200)))
  8. print("Actual..DT: "+ str(time.strftime("%Y-%m-%d-%H:%M:%S")))
  9. print("RTC.....DT: " + str(pms.getRtcTime(Definition.TIME_FORMAT_DATE_AND_TIME, 100)))
  10. print("RTC.....DT: " + str(pms.getRtcTime(Definition.TIME_FORMAT_EPOCH, 100)))
  11. # -----------------------------------------------------------
  12. # Function for creating scheduling event
  13. # Parameter : uint8 eventID [id]
  14. # Parameter : uint8 scheduleType [time, interval]
  15. # Parameter : uint8 repeat [once, repeated]
  16. # Parameter : uint16 timeOrInterval [exact time[epoch], interval]
  17. # Parameter : uint8 interval_type [seconds, minutes, hours]
  18. # Parameter : uint8 repeatPeriod [day_factor]
  19. # Parameter : uint8 action [start, hard shutdown, soft shutdown, hard reboot, soft reboot]
  20. # Return : result
  21. # -----------------------------------------------------------
  22. """
  23. print("RTC: " + str(pms.setRtcTime(1)))
  24. print("RTC.....DT: " + str(pms.getRtcTime(Definition.TIME_FORMAT_EPOCH)))
  25. print("RTC.....DT: " + str(pms.getRtcTime(Definition.TIME_FORMAT_DATE_AND_TIME)))
  26. """
  27. # Remove all evnts
  28. print("Result removing all Scheduled Event: " + str(pms.removeAllScheduledEvents(200)))
  29. # Create Scheduled Events
  30. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(1,2,1,10,1,Definition.EVERYDAY,2,200)))
  31. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(2,2,1,20,1,Definition.EVERYDAY,2,200)))
  32. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(3,2,1,30,1,Definition.EVERYDAY,3,200)))
  33. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(4,2,1,40,1,Definition.EVERYDAY,4,200)))
  34. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(5,2,1,50,1,Definition.EVERYDAY,5,200)))
  35. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(6,2,1,60,1,Definition.EVERYDAY,1,200)))
  36. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(7,2,1,70,1,Definition.EVERYDAY,2,200)))
  37. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(8,2,1,80,1,Definition.EVERYDAY,3,200)))
  38. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(9,2,1,90,1,Definition.EVERYDAY,4,200)))
  39. print("Result creating Scheduled Event: " + str(pms.createScheduledEvent(10,2,1,100,1,Definition.EVERYDAY,5,200)))
  40. # Get Active Scheduled Event IDs
  41. print("IDs of Scheduled Events: " + str(pms.getScheduledEventIds(50)))
  42. # Remove event by using id
  43. #print("Result removing Scheduled Event: " + str(pms.removeScheduledEvent(1)))
  44. #print("Result removing Scheduled Event: " + str(pms.removeScheduledEvent(3)))