def subscribeCollectionEvent(self, ceid, dvs, report_id): clientCommandThread = threading.Thread( target=self.client.subscribe_collection_event, args=(ceid, dvs, report_id), name="TestGemHostHandlerPassive_subscribeCollectionEvent") clientCommandThread.daemon = True # make thread killable on program termination clientCommandThread.start() packet = self.server.expect_packet(function=33) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F34(secsgem.DRACK.ACK)) self.server.simulate_packet(packet) packet = self.server.expect_packet(function=35) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F36(secsgem.LRACK.ACK)) self.server.simulate_packet(packet) packet = self.server.expect_packet(function=37) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F38(secsgem.ERACK.ACCEPTED)) self.server.simulate_packet(packet) clientCommandThread.join(1) self.assertFalse(clientCommandThread.isAlive())
def testDisableCeidReports(self): self.server.simulate_connect() self.performSelect() clientCommandThread = threading.Thread( target=self.client.disable_ceid_reports, name="TestSecsHandlerPassive_testDisableCeidReports") clientCommandThread.daemon = True # make thread killable on program termination clientCommandThread.start() packet = self.server.expect_packet(function=33) self.assertIsNot(packet, None) self.assertEqual(packet.header.sType, 0x00) self.assertEqual(packet.header.sessionID, 0x0) self.assertEqual(packet.header.stream, 2) self.assertEqual(packet.header.function, 33) function = self.client.secs_decode(packet) self.assertEqual(function["DATAID"], 0) self.assertEqual(function["DATA"].get(), []) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F34(secsgem.DRACK.ACK)) self.server.simulate_packet(packet) clientCommandThread.join(1) self.assertFalse(clientCommandThread.isAlive())
def testClearCollectionEvents(self): self.establishCommunication() clientCommandThread = threading.Thread( target=self.client.clear_collection_events, name="TestGemHostHandlerPassive_testClearCollectionEvents") clientCommandThread.daemon = True # make thread killable on program termination clientCommandThread.start() packet = self.server.expect_packet(function=37) self.assertIsNot(packet, None) self.assertEqual(packet.header.sType, 0x00) self.assertEqual(packet.header.sessionID, 0x0) self.assertEqual(packet.header.stream, 2) self.assertEqual(packet.header.function, 37) function = self.client.secs_decode(packet) self.assertEqual(function["CEED"], False) self.assertEqual(function["CEID"].get(), []) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F38(secsgem.ERACK.ACCEPTED)) self.server.simulate_packet(packet) packet = self.server.expect_packet(function=33) self.assertIsNot(packet, None) self.assertEqual(packet.header.sType, 0x00) self.assertEqual(packet.header.sessionID, 0x0) self.assertEqual(packet.header.stream, 2) self.assertEqual(packet.header.function, 33) function = self.client.secs_decode(packet) self.assertEqual(function["DATAID"], 0) self.assertEqual(function["DATA"].get(), []) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F34(secsgem.DRACK.ACK)) self.server.simulate_packet(packet) clientCommandThread.join(1) self.assertFalse(clientCommandThread.isAlive())
def testSubscribeCollectionEventWithoutReportId(self): self.establishCommunication() clientCommandThread = threading.Thread( target=self.client.subscribe_collection_event, args=(10, [20]), name="TestGemHostHandlerPassive_testSubscribeCollectionEvent") clientCommandThread.daemon = True # make thread killable on program termination clientCommandThread.start() packet = self.server.expect_packet(function=33) self.assertIsNot(packet, None) self.assertEqual(packet.header.sType, 0x00) self.assertEqual(packet.header.sessionID, 0x0) self.assertEqual(packet.header.stream, 2) self.assertEqual(packet.header.function, 33) function = self.client.secs_decode(packet) self.assertEqual(function["DATAID"], 0) self.assertEqual(function["DATA"][0]["VID"][0], 20) rptid = function["DATA"][0]["RPTID"] packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F34(secsgem.DRACK.ACK)) self.server.simulate_packet(packet) packet = self.server.expect_packet(function=35) self.assertIsNot(packet, None) self.assertEqual(packet.header.sType, 0x00) self.assertEqual(packet.header.sessionID, 0x0) self.assertEqual(packet.header.stream, 2) self.assertEqual(packet.header.function, 35) function = self.client.secs_decode(packet) self.assertEqual(function["DATAID"], 0) self.assertEqual(function["DATA"][0]["CEID"], 10) self.assertEqual(function["DATA"][0]["RPTID"][0], rptid) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F36(secsgem.LRACK.ACK)) self.server.simulate_packet(packet) packet = self.server.expect_packet(function=37) self.assertIsNot(packet, None) self.assertEqual(packet.header.sType, 0x00) self.assertEqual(packet.header.sessionID, 0x0) self.assertEqual(packet.header.stream, 2) self.assertEqual(packet.header.function, 37) function = self.client.secs_decode(packet) self.assertEqual(function["CEED"], True) self.assertEqual(function["CEID"][0], 10) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F36(secsgem.LRACK.ACK)) self.server.simulate_packet(packet) clientCommandThread.join(1) self.assertFalse(clientCommandThread.isAlive())
# Change equipment constant ECID print(secsgem.SecsS02F15()) print(secsgem.SecsS02F16()) # Set trace condition # print(secsgem.SecsS02F23()) # print(secsgem.SecsS02F24()) # Request equipment constant ECID list print(secsgem.SecsS02F29()) print(secsgem.SecsS02F30()) # Set Report print(secsgem.SecsS02F33()) print(secsgem.SecsS02F34()) # Get Timer print(secsgem.SecsS02F17()) print(secsgem.SecsS02F18()) # #Event print(secsgem.SecsS06F11()) print(secsgem.SecsS06F12()) #Alarm print(secsgem.SecsS05F01()) print(secsgem.SecsS05F02()) # In[] f = secsgem.SecsS02F33()