decode($body); self::log($data, 'BoxUpgradeServer', self::$LOG_MAJOR); return $this->response(); } const RESPONSE_SUCCESS = '01'; const RESPONSE_FAIL = '00'; protected function response($response_status = self::RESPONSE_FAIL) { $body = [ $response_status ]; $body = str_split(implode('', $body), 2); return $body; } /** * 解析装载的数据 * @param $body * @return array * User: Mead */ private function decode($body) { $i = 0; $box_no = self::stitching($body, $i, 5); $i += 5; // 客户代码 $code = self::stitching($body, $i, 2); // 客户型号 $i += 2; // 硬件型号 $i += 2; // 需下载固件版本号 $i += 3; // 固件类型 $i += 1; // 分块机制 $i += 1; // 数据块编号 $i += 2; // 处理值 $box_no = $this->decodeBoxNo($box_no); return [ 'box_no' => $box_no, 'code' => $code ]; } }