def export(self): arguments = [] bright_value = str(self.scale0.get()) arguments.insert(0, bright_value) client.transfer_message(TCP_IP, '01', '1', arguments) print("Brightness: {}".format(bright_value)) arguments = [] sharpness_value = str(self.scale1.get()) arguments.insert(0, sharpness_value) client.transfer_message(TCP_IP, '04', '1', arguments) print("Sharpness: {}".format(sharpness_value)) arguments = [] contrast_value = str(self.scale2.get()) arguments.insert(0, contrast_value) client.transfer_message(TCP_IP, '05', '1', arguments) print("Contrast: {}".format(contrast_value)) arguments = [] saturation_value = str(self.scale3.get()) arguments.insert(0, saturation_value) client.transfer_message(TCP_IP, '06', '1', arguments) print("Saturation: {}".format(saturation_value)) arguments = [] ISO_value = str(self.scale4.get()) arguments.insert(0, ISO_value) client.transfer_message(TCP_IP, '07', '1', arguments) print("ISO: {}".format(ISO_value)) arguments = []
def stream(TCP_IP): arguments = [] arguments.insert(0, socket.gethostbyname(socket.gethostname())) client.transfer_message(TCP_IP, '14', '1', arguments) # Start a socket listening for connections on 0.0.0.0:8000 (0.0.0.0 means # all interfaces) server_socket = socket.socket() server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_socket.bind(('0.0.0.0', 8000)) server_socket.listen(0) # Accept a single connection and make a file-like object out of it connection = server_socket.accept()[0].makefile('rb') try: # Run a viewer with an appropriate command line. Uncomment the mplayer # version if you would prefer to use mplayer instead of VLC cmdline = ['vlc.exe', '--demux', 'mjpeg', '-'] #cmdline = ['mplayer.exe', '-fps', '25', '-cache', '1024', '-'] player = subprocess.Popen(cmdline, stdin=subprocess.PIPE) while True: # Repeatedly read 1k of data from the connection and write it to # the media player's stdin data = connection.read(1024) if not data: break player.stdin.write(data) finally: connection.close() server_socket.close() player.terminate()
def load_command_file(self): arg_list = [] filename3 = str(self.form3.get()) command_name = open(filename3, "r+") while True: command = command_name.readline().rstrip() #print("{}".format(command)) if command == '': break no_of_arg = command_name.readline().rstrip() #print("{}".format(no_of_arg)) for num in range(0, int(no_of_arg)): arg = command_name.readline() arg_list.append(arg.rstrip()) client.transfer_message(TCP_IP, command, no_of_arg, arg_list) arg_list.clear()
def output_off(self): arguments = [] arguments.insert(0, '4') client.transfer_message(TCP_IP, '19', '1', arguments)
def stop_demo(self): arguments = [] client.transfer_message(TCP_IP, '10', '0', arguments)
def start_demo(self): self.export() arguments = [] client.transfer_message(TCP_IP, '09', '0', arguments)
def capture_image(self): arguments = [] client.transfer_message(TCP_IP, '16', '0', arguments)
def disconnect(self): arguments = [] client.transfer_message(TCP_IP, '17', '0', arguments)
def server(self): arguments = [] arguments.insert(0, socket.gethostbyname(socket.gethostname())) client.transfer_message(TCP_IP, '18', '1', arguments) subprocess.Popen("python network.py {}".format(TCP_IP))
def counterclockwise(self): dir2 = [] dir2.append('<') client.transfer_message(TCP_IP, '13', '1', dir2) pass
def clockwise(self): dir1 = [] dir1.append('>') client.transfer_message(TCP_IP, '13', '1', dir1) pass