Example #1
0
def send_sign_alert(call):
    """send the sign an call notification."""
    with lock:
        touch(timeout_file)
        print str(datetime.datetime.now()) + ': sending alert'
        s = AlphaSign.Sign('/dev/ttyUSB0')

        color = '<red>'

        # if first-due box, flash special message
        if call['first_due_box']:
            # MODE_SPARKLE?
            text = AlphaSign.encodeText(
                '<slowest>' + color + '<7>1st DUE BOX!')[:125]
            s.sendText('0', text, AlphaSign.MODE_FLASH)
        else:
            if 'nature' in call:
                nature = call['nature']
            else:
                nature = 'UNKNOWN'
            
            # decide on color and apperatus
            unit = call['station_units']
            color = getColor(unit)
            text = AlphaSign.encodeText(
                '<slowest>' + color + '<7>' + nature)[:125]
            s.sendText('0', text, AlphaSign.MODE_FLASH)

        s.beep()
        # wait for sign to flash....
        time.sleep(7)

        if 'nature' in call:
            nature = call['nature']

        box = "BOX " + call['box_area']
        address = call['address']
        unit = call['station_units']

        address_nature = unit + " - " + box + " - " + nature + " - " + address
        text = AlphaSign.encodeText(
            '<slowest>' + color + '<7>' + address_nature)[:125]
        s.sendText('0', text, AlphaSign.MODE_ROTATE)

        touch(timeout_file)

        t = threading.Timer(100.0, clock_manager)
        t.start()
Example #2
0
def main ():
	s = AlphaSign.Sign( '/dev/tty.PL2303-00001004' )
	s.clearMem()
	s.setClock()
	print s.getClock()
	s.sendTextPriority( AlphaSign.encodeText( '<slowest><green><7>test <red><5>message' ) , AlphaSign.MODE_ROTATE )
	return 0
def update_clock():
    """Set sign clock to current date/time."""
    # TODO: set date
    print str(datetime.datetime.now()) + ': reseting to clock'
    s = AlphaSign.Sign('/dev/ttyUSB0')
    s.setClock()
    s.sendTextPriority(AlphaSign.encodeText('<slowest><dimgreen><7><clock>'))
def update_clock():
    """Update the clock."""
    # TODO: check if clock is already on the screen, if yes, do nothing
    # TODO: Aquire system-wide lock on sign
    s = AlphaSign.Sign("/dev/ttyUSB0")
    s.setClock()
    s.setDate()
    # print s.getClock()
    s.sendTextPriority(AlphaSign.encodeText("<slowest><dimgreen><7><clock> <date>"))
Example #5
0
def main():
    s = AlphaSign.Sign('/dev/ttyUSB0')
    s.clearMem()
    s.setClock()
    s.setDate()
    #print s.getClock()
    s.sendTextPriority(
        AlphaSign.encodeText('<slowest><dimgreen><7><clock> <date>'))
    return 0
def main ():
        
        s = AlphaSign.Sign( 'com3' )
        
        while 1:
                resultsDict=searchTweets("#BockLedSign")
                for result in resultsDict: 
                        print "Found:",result["text"],"\n"

                signText="<nohold><slow><g><block><dr> "
                for i in range(0,2):
                        tempText=resultsDict[i]["text"]

                        tempText=tempText.split("#")[0].strip()
                        tempText=tempText.replace("&lt;", "<")
                        tempText=tempText.replace("&gt;", ">")
                        signText+=tempText + " <g><block><dr> "

                print "Most Recent:",signText,"\n"
                
                s.sendTextPriority(AlphaSign.encodeText(signText),'a')
                time.sleep(30)
        return 0