def main(ip="172.16.16.2" , port=9520 , texts=""): ser = socket(AF_INET, SOCK_STREAM) addr = (ip, port) ser.connect(addr) # Turn Sign On ser.send(Message.TurnSignOn()) time.sleep(0.2) # files = [] if True: for i in range(len(texts)): files.append(generateTextScreen(str(texts[i]) , name=str(i) + ".nmg")) for f in files: debug_print("Writing file..." + f.label + " to drive: " + f.drive) if f.type == 'T': data = Message.WriteTextFilewithChecksum(f) debug_print(data) ser.send(data) elif f.type == 'P': for packetNumber in range(0,f.numPackets): debug_print("Writing image " + f.label + " do drive: " + f.drive + " packet number: " + str(packetNumber)) ser.send(Message.WritePictureFileWithChecksum(f, packetNumber=packetNumber)) time.sleep(0.2) ss = SEQUENTSYS(files) # just write the playlist as a system file playlist = Message.WriteSystemFile(ss) debug_print("Writing playlist...") debug_print(playlist) ser.send(playlist) debug_print("Script complete.") ser.close() sys.exit(0)
#port = '/dev/ttyUSB0' #port = '/dev/ttyACM0' port = '/dev/ttyVIRTUAL' baudRate = 19200 ser = serial.Serial(port, baudRate) if True: for f in files: print("Writing file..." + f.label + " to drive: " + f.drive) if f.type == 'T': ser.write(Message.WriteTextFilewithChecksum(f)) elif f.type == 'P': for packetNumber in range(0,f.numPackets): print("Writing image " + f.label + " do drive: " + f.drive + " packet number: " + str(packetNumber)) ser.write(Message.WritePictureFileWithChecksum(f, packetNumber=packetNumber)) time.sleep(1) time.sleep(1) if True: # the actual playlist is a SEQUENT.SYS ss = SEQUENTSYS(files) # just write the playlist as a system file playlist = Message.WriteSystemFile(ss) print("Writing playlist...") ser.write(playlist) print("Script complete.") ser.close()
# #****************************************************************************** import serial from JetFileII import Message import time msgs = [] msgs.append( Message.File('Today:{mm/dd/yy}{nl}{hhmin_12hr}:{sec}', file_label='time.TXT')) msgs.append(Message.File('WEATHER', file_label='WEATHER.TXT')) #msgs.append( Message.File('NEWS',file_label='NEWS.TXT') ) #msgs.append( Message.File('SPORTS',file_label='SPORTS.TXT') ) playlist = Message.WriteSystemFile(Message.Playlist(msgs)) #print "Playlist is: " + playlist.encode('hex') #print playlist port = '/dev/ttyS0' baudRate = 19200 ser = serial.Serial(port, baudRate) time.sleep(1) for msg in msgs: #print msg.data.encode("hex") x = ser.write(msg.data) time.sleep(1)