/** * @param string $receivedData * @return \Illuminate\Http\Response */ public function handleSystemMessage($receivedData) { $receivedData = substr($receivedData, 1, strlen($receivedData)); $messageParts = ["", ""]; if (strpos($receivedData, '|') !== false) { $messageParts = explode('|', $receivedData); } $device = $messageParts[0]; $message = $messageParts[1]; if ($message == 'boot') { $this->acsNodeRepository->logBoot($device); } elseif ($message == 'heartbeat') { $this->acsNodeRepository->logHeartbeat($device); } //Log::debug("System Message: ".$receivedData); return \Response::make(PHP_EOL, 200); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response * * @SWG\Post( * path="/acs/node/heartbeat", * tags={"acs"}, * description="Record a heartbeat message, used to determin if the device is online", * @SWG\Response(response="200", description="Heartbeat recorded"), * security={{"api_key": {}}} * ) */ public function heartbeat(Request $request) { $node = $this->ACSNodeRepository->findByAPIKey($request->header('ApiKey')); $this->ACSNodeRepository->logHeartbeat($node->device_id); }