Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. Index: aymaster/aypy/devices/device_aver.py
  2. ===================================================================
  3. --- aymaster/aypy/devices/device_aver.py (revision 28871)
  4. +++ aymaster/aypy/devices/device_aver.py (working copy)
  5. @@ -199,7 +199,6 @@
  6. port = int(self.params["port"].value)
  7. user = str(self.params["user"].value)
  8. password = str(self.params["password"].value)
  9. -
  10. # r = protonemo((ip, int(port)), "CHECK_SERVER_VERSION")
  11. # r = protonemo((ip, int(port)), "GET_NCHANNEL")
  12. # r = protonemo((ip, int(port)), "GET_MAX_STREAM_NUM")
  13. @@ -212,8 +211,10 @@
  14. 'version': '',
  15. 'model': '',
  16. 'sn': sn})
  17. - r = protonemo((ip, int(port)), "GET_CONFIG")
  18. - if r:
  19. +
  20. + r = protonemo((ip, int(port)), "CONNECT %s %s" % (user, base64.b64encode(password)))
  21. + # OK -1 -1 -1 is returned if login is correct, OK 0 0 0 is the string if the login is not correct
  22. + if r.startswith('OK -1 -1 -1'):
  23. if self.__status != 'connected':
  24. self.__status = self.device_new_status(self.__objid, 'connected')
  25. else:
  26. @@ -222,6 +223,7 @@
  27. self._stop_proxy()
  28. self.handle_object_end()
  29. return
  30. + r = protonemo((ip, int(port)), "GET_CONFIG")
  31. # start proxy only if aver device is connected
  32. self._start_proxy()
  33. for i in range(0, 16):
  34. @@ -1062,34 +1064,15 @@
  35.  
  36. k = AverDevicePlugin(info[0])
  37. #print k.check_slave("192.168.5.74", "8", "admin", "admin123")
  38. - #===========================================================================
  39. - # for (kk, v) in [("ip", "10.239.252.12"),
  40. - # ("port", 5550),
  41. - # ("user", "admin"),
  42. - # ("password", "4690"),
  43. - # ("db.id", "321"),
  44. - # ("speed", "low"),
  45. - # ("name", "avertest")]:
  46. - #===========================================================================
  47.  
  48. - for (kk, v) in [("ip", "10.20.18.3"),
  49. - ("port", 5550),
  50. + for (kk, v) in [("ip", "192.168.5.79"),
  51. + ("port", 80),
  52. ("user", "admin"),
  53. - ("password", "9046"),
  54. + ("password", "admin123"),
  55. ("db.id", "33008"),
  56. ("speed", "low"),
  57. ("name", "avertest")]:
  58.  
  59. - #===========================================================================
  60. - # for (kk, v) in [("ip", "192.168.5.79"),
  61. - # ("port", 5550),
  62. - # ("user", "admin"),
  63. - # ("password", "admin123"),
  64. - # ("db.id", "33008"),
  65. - # ("speed", "low"),
  66. - # ("name", "avertest")]:
  67. - #===========================================================================
  68. -
  69. k.params[kk] = PV(kk, v)
  70. k.start()
  71.  
  72. @@ -1096,7 +1079,7 @@
  73. #inizio = "20170421085443110359"
  74. #fine = "20170421121843110359"
  75. #print k.search_status(1, inizio, fine, 3000, 0)
  76. - #k.poll()
  77. + k.poll()
  78. #time.sleep(100)
  79. # reactor.callLater(5, k.poll)
  80. # reactor.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement