Changeset 2298

Show
Ignore:
Timestamp:
02/15/10 17:14:19 (5 months ago)
Author:
fma
Message:

Added shutdown() method

Location:
trunk/papywizard
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/papywizard/hardware/abstractHardware.py

    r2290 r2298  
    9393        """ 
    9494        pass 
     95 
     96    def shutdown(self): 
     97        """ Shutdown the low-level hardware. 
     98        """ 
     99        pass 
  • trunk/papywizard/hardware/gigaPanBotHardware.py

    r2286 r2298  
    189189            except IOError: 
    190190                Logger().exception("GigaPanBotHardware.__sendCmd") 
    191                 Logger().warning("GigaPanBotHardware.__sendCmd(): %s axis %d can't sent command %s. Retrying..." % (NAME, self._axis, repr(cmd))) 
     191                Logger().warning("GigaPanBotHardware.__sendCmd(): axis %d can't sent command %s. Retrying..." % (self._axis, repr(cmd))) 
    192192            else: 
    193193                break 
    194194        else: 
    195             raise HardwareError("%s axis %d can't send command %s" % (NAME, self._axis, repr(cmd))) 
     195            raise HardwareError("Axis %d can't send command %s" % (self._axis, repr(cmd))) 
    196196        #Logger().debug("GigaPanBotHardware.__sendCmd(): axis %d ans=%s" % (self._axis, repr(answer))) 
    197197 
     
    199199 
    200200    def init(self): 
    201         """ Init the GigaPanBot hardware. 
    202  
    203         Done only once per axis. 
    204         """ 
    205201        self._driver.acquireBus() 
    206202        try: 
     
    217213            self.__encoderFullCircle = self.__decodeAxisValue(value) 
    218214            Logger().debug("GigaPanBotHardware.init(): full circle count=%s" % hex(self.__encoderFullCircle)) 
     215 
     216            # Tell the controller we are connected 
     217            self.__sendCmd("F", "1") 
     218 
     219        finally: 
     220            self._driver.releaseBus() 
     221 
     222    def shutdown(self): 
     223        self._driver.acquireBus() 
     224        try: 
     225 
     226            # Tell the controller we are disconnected 
     227            self.__sendCmd("F", "0") 
    219228 
    220229        finally: 
  • trunk/papywizard/plugins/abstractHardwarePlugin.py

    r2279 r2298  
    103103        self._hardware.setNbRetry(ConfigManager().getInt('Plugins/HARDWARE_COM_RETRY')) 
    104104        self._hardware.init() 
     105 
     106    def shutdown(self): 
     107        Logger().trace("AbstractHardwarePlugin.shutdown()") 
     108        AbstractPlugin.shutdown(self) 
     109        self._hardware.shutdown()