def intialize(self):
        """initialize the serial port with baudrate, timeout parameters"""
        print '%s call intialize' % self.port
        try:
            # init serial port
            self.deviceConnected = False
            self._connect()

            if self.deviceConnected:
                self.UIStatusMsg = self.getVersionNumber()
                if self.firmwarePrefix not in self.UIStatusMsg:
                    self.deviceConnected = False
                    self.UIStatusMsg = 'Firmware Not Matching Expecting ' + self.firmwarePrefix + ' Now is ' + self.UIStatusMsg
                    raise Exception('Err: OpenThread device Firmware not matching..')
                self.__sendCommand(WPANCTL_CMD + 'leave')
                self.__sendCommand(WPANCTL_CMD + 'dataset erase')
            else:
                raise Exception('Err: Device not connected ..')

        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger('intialize() Error: ' + str(e))
def intialize ( self ) : print '%s call intialize' % self . port try : self . deviceConnected = False self . _connect ( ) if self . deviceConnected : self . UIStatusMsg = self . getVersionNumber ( ) if self . firmwarePrefix not in self . UIStatusMsg : self . deviceConnected = False self . UIStatusMsg = 'Firmware Not Matching Expecting ' + self . firmwarePrefix + ' Now is ' + self . UIStatusMsg raise Exception ( 'Err: OpenThread device Firmware not matching..' ) self . __sendCommand ( WPANCTL_CMD + 'leave' ) self . __sendCommand ( WPANCTL_CMD + 'dataset erase' ) else : raise Exception ( 'Err: Device not connected ..' ) except Exception , e : ModuleHelper . WriteIntoDebugLogger ( 'intialize() Error: ' + str ( e ) )
initialize the serial port with baudrate, timeout parameters