def pub_img_data(self, topic_name, msg, time): img_req_proto_obj = imageservice_pb2.ImageRequest() img_resp_proto_obj = imageservice_pb2.ImageResponse() img_req_proto_obj.ParseFromString(msg) device_name = img_req_proto_obj.request_device_name channel_name = img_req_proto_obj.request_channel_name timestamp = img_req_proto_obj.required_timestamp print ">>>>..", channel_name, timestamp h5file_obj = H5ReaderSequence(fname) encoded_img_arr = h5file_obj.get_img_for_tmstamp_and_chnl( device_name, channel_name, timestamp) if encoded_img_arr is not None: img_resp_proto_obj.response_device_name = device_name img_resp_proto_obj.recieved_timestamp = timestamp img_resp_proto_obj.response_channel_name = channel_name img_resp_proto_obj.base_image = encoded_img_arr else: img_resp_proto_obj.recieved_timestamp = -1 self.h5_img_publr_obj.send(img_resp_proto_obj.SerializeToString())
import ecal import AlgoInterface_pb2 import imageservice_pb2 import sys ecal.initialize(sys.argv, "HFL data requestor") hfl_publ_obj = ecal.publisher("Request_Image") import time time.sleep(2) hfl_req_proto_obj = imageservice_pb2.ImageRequest() def request_hfl_data(): # while ecal.ok(): # hfl_req_proto_obj.required_timestamp = 1504816617728550 hfl_req_proto_obj.image_index = 8 #1504816617788522 # hfl_req_proto_obj.hfl_file_name = "D:\\Work\\2018\\code\\LT5G\\HDF5_reader\\2017.09.07_at_20.37.57_camera-mi_1449.h5" hfl_publ_obj.send(hfl_req_proto_obj.SerializeToString()) ecal.finalize() request_hfl_data()