atv_channel_table.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # -*- coding: UTF-8 -*-
  2. from utils.serial_TG39BX1 import *
  3. class AtvChannelTable():
  4. """
  5. VHF/UHF/CATV Channel Table
  6. """
  7. def __init__(self, port):
  8. self.tg39ser = Serial_TG39BX1(port)
  9. self.tg39ser.open()
  10. # self.tg39ser.execmd("VCOL 1")
  11. # self.tg39ser.execmd("VSIGCB 1")
  12. # self.tg39ser.execmd("SUSA")
  13. # self.tg39ser.execmd("SCAR 1")
  14. # self.tg39ser.execmd("SMODE 2")
  15. # self.tg39ser.execmd("SCH1 1")
  16. # self.tg39ser.execmd("RSYS 0")
  17. # 使用TG39BX1预制的各国的频道
  18. def setCTYandCHN(self, countryID, channelID):
  19. """
  20. RFCHA-arg1 For arg1, input the country name ID to set (as a decimal number).
  21. RFCHB-arg2 For arg2, input the channel ID to set (as a decimal number).
  22. countryID channelID
  23. 1 JAPAN 1 to 62
  24. 2 USA 2 to 83
  25. 3 EU 1 to 69
  26. 4 CHINA 1 to 68
  27. 5 UK 21 to 69
  28. 6 R 1 to 69
  29. 7 FRANCE 1 to 69
  30. 8 AUSTRALIA 1 to 69
  31. 9 JAPAN-C 1 to 63
  32. 10 USA-C 2 to 150
  33. 11 EU-C 2 to 56
  34. 12 CHINA-C 1 to 51
  35. 13 ITY 1 to 69
  36. 14 IRE 1 to 69
  37. """
  38. self.tg39ser.execmd("RFCHA" + " " + str(countryID))
  39. self.tg39ser.execmd("RFCHB" + " " + str(channelID))
  40. def close(self):
  41. self.tg39ser.close()
  42. def __del__(self):
  43. self.tg39ser.close()
  44. # - - - - - - - - - - - - - - - - - - - - - - - - -
  45. if __name__ == "__main__":
  46. print "ATV USA Channel Table"
  47. atvChannelTable = AtvChannelTable("COM6")
  48. atvChannelTable.setCTYandCHN(2, 81)