equal
deleted
inserted
replaced
29 # TODO multiclient : switch to arrays |
29 # TODO multiclient : switch to arrays |
30 |
30 |
31 svghmi_recv_dispatch = PLCBinary.svghmi_recv_dispatch |
31 svghmi_recv_dispatch = PLCBinary.svghmi_recv_dispatch |
32 svghmi_recv_dispatch.restype = ctypes.c_int # error or 0 |
32 svghmi_recv_dispatch.restype = ctypes.c_int # error or 0 |
33 svghmi_recv_dispatch.argtypes = [ |
33 svghmi_recv_dispatch.argtypes = [ |
34 ctypes.c_uint32, # size |
34 ctypes.c_uint32, # size |
35 ctypes.c_char_p] # data ptr |
35 ctypes.c_char_p] # data ptr |
36 # TODO multiclient : switch to arrays |
36 # TODO multiclient : switch to arrays |
37 |
37 |
38 class HMISession(object): |
38 class HMISession(object): |
39 def __init__(self, protocol_instance): |
39 def __init__(self, protocol_instance): |
58 # TODO multiclient : |
58 # TODO multiclient : |
59 # svghmi_sessions.remove(self) |
59 # svghmi_sessions.remove(self) |
60 |
60 |
61 def onMessage(self, msg): |
61 def onMessage(self, msg): |
62 # pass message to the C side recieve_message() |
62 # pass message to the C side recieve_message() |
63 c_string = ctypes.c_char_p(msg) |
|
64 c_string_pointer = ctypes.c_void_p(ctypes.addressof(c_string)) |
|
65 svghmi_recv_dispatch(len(msg), msg) |
63 svghmi_recv_dispatch(len(msg), msg) |
66 |
64 |
67 # TODO multiclient : pass client index as well |
65 # TODO multiclient : pass client index as well |
68 |
66 |
69 |
67 |