Пример #1
0
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)
Пример #2
0
files = []
if True:
  files.append(TextFile(test, "FT.nmg", drive='D'))


#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)