import SimpleXMLRPCServer
import sys

import logging
from K8055Controller import K8055Controller

logging.basicConfig()

controller_log = logging.getLogger("Controller")

class Controller:
    def __init__(self):
        self.k8055 = K8055Controller()
        controller_log.debug("initialized")
        
    def reset(self):
        self.k8055.reset()
        controller_log.debug("reset")
        return 0
    
    def turn_on(self, i):
        self.k8055.turn_on(i)
        controller_log.debug('turned on %i' % (i))
        return 0
    
    def turn_off(self, i):
        self.k8055.turn_off(i)
        controller_log.debug('turned off %i' % (i))
        return 0
    
    def set_analog(self, i, level):
        if (i == 1):
            self.k8055.set_analog1(level)
        else:
            self.k8055.set_analog2(level)
        return 0

controller = Controller()        
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("d6349.mysql.zone.ee", 7000))
server.register_instance(controller)
server.serve_forever()
[((7, 0, 7, 21), 'logging.basicConfig', 'logging.basicConfig', ({}, {}), '()', False, 'import logging\n'), ((9, 17, 9, 48), 'logging.getLogger', 'logging.getLogger', ({(9, 35, 9, 47): '"""Controller"""'}, {}), "('Controller')", False, 'import logging\n'), ((39, 9, 39, 77), 'SimpleXMLRPCServer.SimpleXMLRPCServer', 'SimpleXMLRPCServer.SimpleXMLRPCServer', ({(39, 47, 39, 76): "('d6349.mysql.zone.ee', 7000)"}, {}), "(('d6349.mysql.zone.ee', 7000))", False, 'import SimpleXMLRPCServer\n'), ((13, 21, 13, 38), 'K8055Controller.K8055Controller', 'K8055Controller', ({}, {}), '()', False, 'from K8055Controller import K8055Controller\n')]