def sendCommand(self, key, value=None): """ sendCommand accepts the following two comman key values: * get_control_status : returns a dictionary with all control structure attributes and current values. * get_config: returns a dictionary in the form {'iNVis':egConfig.iNVis, 'bEyefollower': egConfig.bEyefollower} Args: key: either 'get_control_status' or 'get_config' Returns: dict: result of the command request. """ try: if self._eyegaze_control: if key == 'get_control_status': rdict = dict() for a in self._eyegaze_control.__slots__: v = getattr(self._eyegaze_control, a) rdict[a] = v return rdict elif key == 'get_config': egConfig = pEyeGaze._stEgConfig(0, 0) r = pEyeGaze.EgGetConfig(byref(self._eyegaze_control), byref(egConfig), sizeof(egConfig)) rdict = None if r == 0: rdict = { 'iNVis': egConfig.iNVis, 'bEyefollower': egConfig.bEyefollower } egConfig = None return rdict else: print2err( 'WARNING: EyeGaze command not handled: {0} = {1}.'. format()) except Exception, e: return createErrorResult( "IOHUB_DEVICE_EXCEPTION", error_message= "An unhandled exception occurred on the ioHub Server Process.", method="EyeTracker.sendCommand", key=key, value=value, error=e)