/** * Main entry point for the buttons in the Javascript frontend * @return string json encoded array */ public function dispatchRpcAction() { try { $this->configurationManager->parseRequest(); $subAction = $this->configurationManager->getSubActionFromRequest(); if (empty($subAction)) { throw new Exception('No Sub Action!'); } switch ($subAction) { case 'saveWiring': $response = $this->rpcAction_save(); break; case 'listWirings': $response = $this->rpcAction_list(); break; default: $response = array('error' => 'Sub Action not found.'); } } catch (Exception $e) { $response = array('error' => $e->getMessage()); } return json_encode($response); }