#!/usr/bin/python

# Implement an instance of the Mate class, then keep it populated.

# At intervals check values and update any changes to the Jace via OBIX.

from mate_enum import Mate
from jacexml import Jace
import time

serport = '/dev/mate'
ser = Mate(serport)

server = 'server.name'
user = 'user.name'
passwd = 'password'
jace = Jace (server, user, passwd)

counter = time.time()
while 1:
    ser.scan(jace.fxModeCmd, jace.fxAuxCmd)

    if time.time() - counter > 5:
        data = ser.getDevices()
        jace.update(data)
        counter = time.time()

#        print 
#        print 'Commands:'
#        print jace.fxModeCmd, jace.fxAuxCmd

    #print ser.getDevices()


