예제 #1
0
파일: pop3.py 프로젝트: untoha/LEDSign
 def CheckEmail(self):
     pop3 = poplib.POP3_SSL(self.pop3_server, self.port)
     pop3.user(self.user)
     pop3.pass_(self.pw)
     messages = [pop3.retr(i) for i in range(1, len(pop3.list()[1]) + 1)]
     # Concat message pieces:
     messages = ["\n".join(mssg[1]) for mssg in messages]
     #Parse message intom an email object:
     messages = [parser.Parser().parsestr(mssg) for mssg in messages]
     for message in messages:
         subject = message['subject']
         sender = message['from']
         msg = '{nonein}{noneout}{red}{7x6}{flashon}Email from:{flashoff}'
         msg = msg + '{nl}{amber}' + sender + '{nl}{nonein}{noneout}{flashon}{green}subj:{flashoff}{amber}' + subject
         #print msg
         self.email_queue.append(Message.EmergencyMessage(msg, t=25))
     pop3.quit()
예제 #2
0
#!/usr/bin/env python
# vim: set ts=2 expandtab:

#******************************************************************************
#
#   emergencymessage.py
#   Hit sign with an async emergency message
#
#******************************************************************************

import serial
import time
from JetFileII import Message

msg = Message.EmergencyMessage('This is an Emergency!')

#port = '/dev/ttyUSB0'
port = '/dev/ttyACM0'
#port = '/dev/ttyVIRTUAL'
baudRate = 19200

ser = serial.Serial(port, baudRate)

ser.write(msg)

ser.close()
예제 #3
0
# and send it to my LED sign.
# This is a test in preparation for an integrated LED sign server type daemon
# that could have something like this as just one small dedicated 'process'.
#
# REQUIRES: debian package "python-pywapi" available in Ubuntu 12.04 or
# google code.
#
#******************************************************************************

import pywapi
import serial
import time
import datetime
from time import mktime
from datetime import datetime
from JetFileII import Message
displayMsg = Message.DisplayControlWithoutChecksum


msg = Message.EmergencyMessage('Hello there. How are you?')

print msg.encode("hex")

print 'size of message is ' + str(len(msg))

port = '/dev/ttyS0'
baudRate = 19200
ser = serial.Serial(port, baudRate)
x = ser.write(msg)
ser.close()