Ejemplo n.º 1
0
 /**
  * @param array $data
  * @param array $options
  * @return array
  */
 function run_current_task($data = [], $options = [])
 {
     // cheack ap status
     $ap_status = Module_ControlCentre_ApManager::get_instance()->get_current_ap_status();
     if ($ap_status == null) {
         return Lib_Helper::get_err_struct(Const_Err_DataAccess::ERR_AP_STATUS, 'access point without status');
     }
     if ($ap_status != Module_AccessPoint_Main::AP_STATUS_ONLINE) {
         return Lib_Helper::get_err_struct(Const_Err_DataAccess::ERR_AP_STATUS, 'access point is disabled');
     }
     // run task
     $task = $this->get_current_task();
     if (empty($task)) {
         return Lib_Helper::get_err_struct(Const_Err_DataAccess::ERR_TASK_NOT_EXISTS, 'no task to run!');
     }
     try {
         $result = $task->run($data, $options);
     } catch (Exception $ex) {
         return Lib_Helper::get_err_struct($ex->getCode(), $ex->getMessage());
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * @param string $key
  * @return string
  */
 static function current_ap_info($key = null)
 {
     $ap = Module_ControlCentre_ApManager::get_instance()->current_ap();
     return self::_get_data_info($ap, $key);
 }