(11)香橙派+apache2与php+天猫精灵=自建平台语音支持--天猫精灵对接6

导航链接

(1)香橙派+apache2与php+天猫精灵=自建平台语音支持--前言

(2)香橙派+apache2与php+天猫精灵=自建平台语音支持--香橙派操作系统安装

(3)香橙派+apache2与php+天猫精灵=自建平台语音支持--香橙派环境配置

(4)香橙派+apache2与php+天猫精灵=自建平台语音支持--apache2与php

(5)香橙派+apache2与php+天猫精灵=自建平台语音支持--MariaDB的安装

(6)香橙派+apache2与php+天猫精灵=自建平台语音支持--天猫精灵对接1

(7)香橙派+apache2与php+天猫精灵=自建平台语音支持--天猫精灵对接2

(8)香橙派+apache2与php+天猫精灵=自建平台语音支持--天猫精灵对接3

(9)香橙派+apache2与php+天猫精灵=自建平台语音支持--天猫精灵对接4

(10)香橙派+apache2与php+天猫精灵=自建平台语音支持--天猫精灵对接5

(11)香橙派+apache2与php+天猫精灵=自建平台语音支持--天猫精灵对接6

(12)香橙派+apache2与php+天猫精灵=自建平台语音支持--天猫精灵对接7

设备查询

还是先上个时序图,看图基本功能也就都知道了。

下图为设备响应指令的详细协议以及协议的解析和响应
 

    case 'AliGenie.Iot.Device.Query': {error_log('----case in Query----');$result = device_status($obj, $messageId);break;}

协议的解析和设备控制协议的解析采用的思想差不多,只不过查询和控制这两个过程是正好相反的。过程控制是主动存储数据,然后又硬件设备读取,查询是硬件设备返回数据存储到服务器上在查询的时候读取。就这样,具体的代码看aligenies_handle.php中的内容吧,这里会调用存储读取的具体PHP。

function device_status($obj, $messageId)
{error_log('----device_status in----');global $sqlFileName;$deviceId = $obj->payload->deviceId;$action = '';$deviceType = check_type_from_id($deviceId);switch ($obj->header->name) {case 'QueryPowerState':$action = 'powerstate';break;case 'QueryColor':$action = 'color';break;case "QueryTemperature":$action = "temperature";break;case "QueryWindspeed":$action = "windspeed";break;case "QueryBrightness":$action = "brightness";break;case "QueryFog":$action = "fog";break;case "QueryHumidity":$action = "humidity";break;case "QueryPm25":$action = "pm25";break;case "QueryChannel":$action = "channel";break;case "QueryNumber":$action = "number";break;case "QueryDirection":$action = "direction";break;case "QueryAngle":$action = "angle";break;case "QueryAnion":$action = "anion";break;case "QueryEffluent":$action = "effluent";break;case "QueryMode":$action = "mode";break;case "QueryLeftTime":$action = "lefttime";break;case "QueryRemoteStatus":$action = "remotestatus";break;case "QueryOnlineState":$action = "onlinestate";break;case "QueryColorTemperature":$action = "colorTemperature";break;case "Query":$action = "all";break;default:$action = "";}    if ($action == "" || $deviceType == "") {$ret = new AliGenie\QueryResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);$ret->payload->putResponseError("DEVICE_NOT_SUPPORT_FUNCTION");$retJson = json_encode($ret);return $retJson;}$properties = array();$findDevice = false;$queryValue = '';if (($txtRes = fopen($sqlFileName, "r")) === false) {error_log('----get_control fopen failed----');$ret = new AliGenie\QueryResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);$ret->payload->putResponseError("SERVICE_ERROR", "CANNOT_OPEN");$retJson = json_encode($ret);return $retJson;}$str = fread($txtRes, filesize($sqlFileName));$sqlObj = json_decode($str);$devArray = $sqlObj->dev_array;$ret = new AliGenie\QueryResponse();$ret->header->putResponseName($obj->header->name);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);foreach ($devArray as $data) {error_log('entity_id-->'.$data->entity_id);error_log('device_type-->'.$data->device_type);if ($data->entity_id == $deviceId) {$findDevice = true;switch ($data->device_type) {case 'ceiling_lamp': {$brightnessWhite = '';$brightnessYellow = '';foreach ($data->properties as $element) {error_log('name-->'.$element->name);error_log('value-->'.$element->value);if ($element->name =='brightness_w') {$brightnessWhite = $element->value;} elseif ($element->name =='brightness_y') {$brightnessYellow = $element->value;} else {$properties[$element->name] = $element->value;}}$properties['brightness'] = ($brightnessWhite>$brightnessYellow)?$brightnessWhite:$brightnessYellow;if ($brightnessWhite != 0 && $brightnessYellow == 0) {$properties['color'] = 'White';} elseif ($brightnessWhite == 0 && $brightnessYellow != 0) {$properties['color'] = 'Yellow';} elseif ($brightnessWhite == $brightnessYellow && $brightnessYellow != 0) {$properties['mode'] = '自然模式';}break;}}}}fclose($txtRes);if ($action != 'all') {$queryValue = $properties[$obj->header->name];array_splice($properties, 0);$properties[$obj->header->name] = $queryValue;}foreach ($properties as $name => $value) {$pro = new AliGenie\QueryPropertie($name, $value);$ret->properties[] = $pro;}if ($findDevice == false) {$ret = new AliGenie\QueryResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);$ret->payload->putResponseError("DEVICE_IS_NOT_EXIST");$retJson = json_encode($ret);return $retJson;} else if ($queryValue == '' && $action != 'all') {$ret = new AliGenie\QueryResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);$ret->payload->putResponseError("INVALIDATE_PARAMS");$retJson = json_encode($ret);return $retJson;}$retJson = json_encode($ret);error_log('----device_status out----');return $retJson;
}

到这里所有的文件部署完毕,我们现在天猫精灵上新建一个智能家居,用于真机测试。

下面是

aligenies_gate.php和aligenies_handle.php完整文件的代码。

aligenies_gate.php

<?php
error_log('----aligenies_gate.php in----');
require_once __DIR__.'/aligenies_handle.php';$chars = md5(uniqid(mt_rand(), true));
$uuid  = substr($chars,0,8) . '-';
$uuid .= substr($chars,8,4) . '-';
$uuid .= substr($chars,12,4) . '-';
$uuid .= substr($chars,16,4) . '-';
$uuid .= substr($chars,20,12);$postStr = file_get_contents("php://input");
$obj = json_decode($postStr);
$messageId = $uuid;
error_log('get-request->'.$postStr);
switch ($obj->header->namespace) {case 'AliGenie.Iot.Device.Discovery': {error_log('----case in Discovery----');$result = device_discovery($messageId);break;}case 'AliGenie.Iot.Device.Control': {error_log('----case in Control----');$result = device_control($obj, $messageId);break;}case 'AliGenie.Iot.Device.Query': {error_log('----case in Query----');$result = device_status($obj, $messageId);break;}default: {$result='Nothing return,there is an error~!!';}
}
echo($result);
error_log('----reseponse----');
error_log($result);
error_log('----aligenies_gate.php out----');
?>

aligenies_handle.php

<?php
require_once __DIR__.'/DiscoveryResponse.php';
require_once __DIR__.'/ControlResponse.php';
require_once __DIR__.'/QueryResponse.php';$sqlFileName = "../sqldata.txt";function device_discovery($messageId)
{error_log('----device_discovery in----');global $sqlFileName;if (($txtRes = fopen($sqlFileName, "r")) === false) {error_log('----gate_implement fopen failed----');$ret = new AliGenie\DiscoveryResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseError("SERVICE_ERROR", "CANNOT_OPEN");$retJson = json_encode($ret);return $retJson;}$str = fread($txtRes, filesize($sqlFileName));error_log("str-->".$str);$obj = json_decode($str);$ret = new AliGenie\DiscoveryResponse();$ret->header->putResponseMessageId($messageId);foreach ($obj->dev_array as $devElement) {error_log('entity_id-->'.$devElement->entity_id);switch ($devElement->device_type) {case 'ceiling_lamp': {$dev = new AliGenie\DiscoveryDevice();$dev->putResponseDeviceInfo($devElement->entity_id, "吸顶灯", device_id_to_devicetype($devElement->entity_id), "https://www.rtplay.cn/icon/td.png");$dev->actions = array("TurnOn","TurnOff","SetBrightness","SetColor","AdjustUpBrightness","AdjustDownBrightness","QueryBrightness","QueryPowerState","QueryColor","Query");$brightnessWhite = '';$brightnessYellow = '';foreach ($devElement->properties as $propertie) {if ($propertie->name =='brightness_w') {$brightnessWhite = $propertie->value;} elseif ($propertie->name =='brightness_y') {$brightnessYellow = $propertie->value;} else {$pro = new AliGenie\DiscoveryPropertie($propertie->name, $propertie->value);$dev->putResponseProperties($pro);}}$brightness = ($brightnessWhite>$brightnessYellow)?$brightnessWhite:$brightnessYellow;$pro = new AliGenie\DiscoveryPropertie("brightness", $brightness);$dev->putResponseProperties($pro);if ($brightnessWhite == 100 && $brightnessYellow == 0) {$pro = new AliGenie\DiscoveryPropertie("color", "White");$dev->putResponseProperties($pro);} elseif ($brightnessWhite == 0 && $brightnessYellow == 100) {$pro = new AliGenie\DiscoveryPropertie("color", "Yellow");$dev->putResponseProperties($pro);} elseif ($brightnessWhite == $brightnessYellow && $brightnessYellow != 0) {$pro = new AliGenie\DiscoveryPropertie("mode", "自然模式");$dev->putResponseProperties($pro);}$ext = new AliGenie\DiscoveryExtension();$dev->putResponseExtensions($ext);$ret->payload->putResponseDevices($dev);break;}case 'gateway_switch': {$dev = new AliGenie\DiscoveryDevice();$dev->putResponseDeviceInfo($devElement->entity_id, "插排", device_id_to_devicetype($devElement->entity_id), "https://www.rtplay.cn/icon/cz.png");$dev->actions = array("TurnOn","TurnOff","QueryPowerState","Query");foreach ($devElement->properties as $propertie) {$pro = new AliGenie\DiscoveryPropertie($propertie->name, $propertie->value);$dev->putResponseProperties($pro);}$ext = new AliGenie\DiscoveryExtension();$dev->putResponseExtensions($ext);$ret->payload->putResponseDevices($dev);break;}}}$retJson = json_encode($ret);error_log('retJson-->'.$retJson);error_log('----device_discovery out----');return $retJson;
}function device_status($obj, $messageId)
{error_log('----device_status in----');global $sqlFileName;$deviceId = $obj->payload->deviceId;$action = '';$deviceType = check_type_from_id($deviceId);switch ($obj->header->name) {case 'QueryPowerState':$action = 'powerstate';break;case 'QueryColor':$action = 'color';break;case "QueryTemperature":$action = "temperature";break;case "QueryWindspeed":$action = "windspeed";break;case "QueryBrightness":$action = "brightness";break;case "QueryFog":$action = "fog";break;case "QueryHumidity":$action = "humidity";break;case "QueryPm25":$action = "pm25";break;case "QueryChannel":$action = "channel";break;case "QueryNumber":$action = "number";break;case "QueryDirection":$action = "direction";break;case "QueryAngle":$action = "angle";break;case "QueryAnion":$action = "anion";break;case "QueryEffluent":$action = "effluent";break;case "QueryMode":$action = "mode";break;case "QueryLeftTime":$action = "lefttime";break;case "QueryRemoteStatus":$action = "remotestatus";break;case "QueryOnlineState":$action = "onlinestate";break;case "QueryColorTemperature":$action = "colorTemperature";break;case "Query":$action = "all";break;default:$action = "";}    if ($action == "" || $deviceType == "") {$ret = new AliGenie\QueryResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);$ret->payload->putResponseError("DEVICE_NOT_SUPPORT_FUNCTION");$retJson = json_encode($ret);return $retJson;}$properties = array();$findDevice = false;$queryValue = '';if (($txtRes = fopen($sqlFileName, "r")) === false) {error_log('----get_control fopen failed----');$ret = new AliGenie\QueryResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);$ret->payload->putResponseError("SERVICE_ERROR", "CANNOT_OPEN");$retJson = json_encode($ret);return $retJson;}$str = fread($txtRes, filesize($sqlFileName));$sqlObj = json_decode($str);$devArray = $sqlObj->dev_array;$ret = new AliGenie\QueryResponse();$ret->header->putResponseName($obj->header->name);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);foreach ($devArray as $data) {error_log('entity_id-->'.$data->entity_id);error_log('device_type-->'.$data->device_type);if ($data->entity_id == $deviceId) {$findDevice = true;switch ($data->device_type) {case 'ceiling_lamp': {$brightnessWhite = '';$brightnessYellow = '';foreach ($data->properties as $element) {error_log('name-->'.$element->name);error_log('value-->'.$element->value);if ($element->name =='brightness_w') {$brightnessWhite = $element->value;} elseif ($element->name =='brightness_y') {$brightnessYellow = $element->value;} else {$properties[$element->name] = $element->value;}}$properties['brightness'] = ($brightnessWhite>$brightnessYellow)?$brightnessWhite:$brightnessYellow;if ($brightnessWhite != 0 && $brightnessYellow == 0) {$properties['color'] = 'White';} elseif ($brightnessWhite == 0 && $brightnessYellow != 0) {$properties['color'] = 'Yellow';} elseif ($brightnessWhite == $brightnessYellow && $brightnessYellow != 0) {$properties['mode'] = '自然模式';}break;}}}}fclose($txtRes);if ($action != 'all') {$queryValue = $properties[$obj->header->name];array_splice($properties, 0);$properties[$obj->header->name] = $queryValue;}foreach ($properties as $name => $value) {$pro = new AliGenie\QueryPropertie($name, $value);$ret->properties[] = $pro;}if ($findDevice == false) {$ret = new AliGenie\QueryResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);$ret->payload->putResponseError("DEVICE_IS_NOT_EXIST");$retJson = json_encode($ret);return $retJson;} else if ($queryValue == '' && $action != 'all') {$ret = new AliGenie\QueryResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseDeviceId($deviceId);$ret->payload->putResponseError("INVALIDATE_PARAMS");$retJson = json_encode($ret);return $retJson;}$retJson = json_encode($ret);error_log('----device_status out----');return $retJson;
}function device_control($obj, $messageId)
{error_log('----device_control in----');global $sqlFileName;$deviceId = $obj->payload->deviceId;$action = '';$deviceType = '';//Customize device type$deviceType = device_id_to_type($deviceId);error_log("deviceType-->".$deviceType);$action = get_control_action($obj->header->name);error_log("action-->".$action);if ($action == "" || $deviceType == "") {error_log('----get_control_action failed----');$ret = new AliGenie\ControlResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseError("SERVICE_ERROR", "action or device not support,name:".$obj->header->name." device:".substr($deviceId,0,stripos($deviceId,".")));$retJson = json_encode($ret);return $retJson;}$validArray = array ("deviceId" => $deviceId,"deviceType" => $deviceType,"actionName" => $obj->header->name,"action" => $action,"attribute" => $obj->payload->attribute,"value" => $obj->payload->value);$checkResult = control_checker($validArray);if ($checkResult != 'succeed') {error_log('----control_checker failed----');$ret = new AliGenie\ControlResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseError("DEVICE_NOT_SUPPORT_FUNCTION");$retJson = json_encode($ret);return $retJson;}//-----------------------------------if (($txtRes = fopen($sqlFileName, "r+")) === false) {error_log('----get_control fopen failed----');$ret = new AliGenie\ControlResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseError("SERVICE_ERROR", "CANNOT_OPEN");$retJson = json_encode($ret);return $retJson;}$str = fread($txtRes, filesize($sqlFileName));error_log("str-->".$str);$sqlObj = json_decode($str);//error_log("sqlObj-->".print_r($sqlObj, true));$ret = new AliGenie\ControlResponse();$ret->header->putResponseMessageId($messageId);$ret->header->putResponseName($obj->header->name);$ret->payload->putResponseDeviceId($obj->payload->deviceId);foreach ($sqlObj->dev_array as $devElement) {error_log('entity_id-->'.$devElement->entity_id);if ($devElement->entity_id == $validArray['deviceId']) {$ret->payload->putResponseDeviceId($devElement->entity_id);switch ($devElement->device_type) {case 'ceiling_lamp': {switch ($validArray['action']) {case 'turn_on': {foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "powerstate") {$propertie->value = "on";break;}}break;}case 'turn_off': {foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "powerstate") {$propertie->value = "off";break;}}break;}case 'bright_set': {foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "brightness_w" && $propertie->value != 0) {$propertie->value = $validArray['value'];} else if ($propertie->name == "brightness_y" && $propertie->value != 0) {$propertie->value = $validArray['value'];}}break;}case 'bright_up': {foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "brightness_w" && $propertie->value != 0) {$propertie->value += $validArray['value'];if ($propertie->value > 100) {$propertie->value = 100;}} else if ($propertie->name == "brightness_y" && $propertie->value != 0) {$propertie->value += $validArray['value'];if ($propertie->value > 100) {$propertie->value = 100;}}if ($propertie->name == "powerstate") {$propertie->value = "on";break;}}break;}case 'bright_down': {$brightnessWhite = '10';$brightnessYellow = '10';foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "brightness_w" && $propertie->value != 0) {$propertie->value -= $validArray['value'];if ($propertie->value < 0) {$propertie->value = 0;}$brightnessWhite = $propertie->value;} else if ($propertie->name == "brightness_y" && $propertie->value != 0) {$propertie->value -= $validArray['value'];if ($propertie->value < 0) {$propertie->value = 0;}$brightnessYellow = $propertie->value;}if ($brightnessWhite == 0 && $brightnessYellow == 0) {foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "powerstate") {$propertie->value = "off";break;}}}}break;}case 'mode_set': {$brightnessWhite = '0';$brightnessYellow = '0';foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "brightness_w") {$brightnessWhite = $propertie->value;} else if ($propertie->name == "brightness_y") {$brightnessYellow = $propertie->value;}}$brightness = ($brightnessWhite>$brightnessYellow)?$brightnessWhite:$brightnessYellow;foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "brightness_w" || $propertie->name == "brightness_y") {$propertie->value = $brightness;}}break;}case 'color_set': {if ($validArray['value'] == 'White') {foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "brightness_w") {$propertie->value = 100;} else if ($propertie->name == "brightness_y") {$propertie->value = 0;}}} else if ($validArray['value'] == 'Yellow') {foreach ($devElement->properties as $propertie) {error_log('name-->'.$propertie->name);if ($propertie->name == "brightness_w") {$propertie->value = 0;} else if ($propertie->name == "brightness_y") {$propertie->value = 100;}}}break;}}break;}}}}$jsonData = json_encode($sqlObj);error_log('jsonData-->'.$jsonData);fclose($txtRes);if (($txtRes = fopen($sqlFileName, "w+")) === false) {error_log('----get_control fopen failed----');$ret = new AliGenie\ControlResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseError("SERVICE_ERROR", "CANNOT_OPEN");$retJson = json_encode($ret);return $retJson;}if (!fwrite($txtRes, $jsonData)) {fclose($txtRes);error_log('----get_control fwrite failed----');$ret = new AliGenie\ControlResponse(true);$ret->header->putResponseMessageId($messageId);$ret->payload->putResponseError("SERVICE_ERROR", "CANNOT_WRITE");$retJson = json_encode($ret);return $retJson;}fclose($txtRes);$retJson = json_encode($ret);error_log('----device_control out----');return $retJson;
}function check_type_from_id($deviceId)
{$deviceType = device_id_to_type($deviceId);if ($deviceType != 'ceiling_lamp' && $deviceType != 'gateway_switch') {$deviceType = "";}return $deviceType;
}function get_control_action($controlName)
{$action = "";switch ($controlName) {case 'TurnOn':$action = 'turn_on';break;case 'TurnOff':$action = 'turn_off';break;case 'SelectChannel':$action = 'channel_set';break;case 'AdjustUpChannel':$action = 'channel_up';break;case 'AdjustDownChannel':$action = 'channel_down';break;case 'AdjustUpVolume':$action = 'volume_up';break;case 'AdjustDownVolume':$action = 'volume_down';break;case 'SetVolume':$action = 'volume_set';break;case 'SetMute':$action = 'mute_set';break;case 'CancelMute':$action = 'mute_cancel';break;case 'Play':$action = 'play';break;case 'Pause':$action = 'pause';break;case 'Continue':$action = 'continue';break;case 'Next':$action = 'next';break;case 'Previous':$action = 'previous';break;case 'SetBrightness':$action = 'bright_set';break;case 'AdjustUpBrightness':$action = 'bright_up';break;case 'AdjustDownBrightness':$action = 'bright_down';break;case 'SetTemperature':$action = 'temperature_set';break;case 'AdjustUpTemperature':$action = 'temperature_up';break;case 'AdjustDownTemperature':$action = 'temperature_down';break;case 'SetWindSpeed':$action = 'windspeed_set';break;case 'AdjustUpWindSpeed':$action = 'WindSpeed_up';break;case 'AdjustDownWindSpeed':$action = 'WindSpeed_down';break;case 'SetMode':$action = 'mode_set';break;case 'SetColor':$action = 'color_set';break;case 'OpenFunction':$action = 'function_open';break;case 'CloseFunction':$action = 'function_close';break;case 'Cancel':$action = 'cancel';break;case 'CancelMode':$action = 'mode_cancel';break;default:break;}return $action;
}function device_id_to_type($deviceId)
{$deviceType = "";$deviceArray = [];$deviceArray = explode('.', $deviceId);$deviceType = $deviceArray[1];return $deviceType;
}function device_id_to_devicetype($deviceId)
{$deviceType = "";$deviceArray = [];$deviceArray = explode('.', $deviceId);$deviceType = $deviceArray[0];return $deviceType;
}function control_checker($arrayData)
{error_log('----control_checker in----');if (empty($arrayData)) {return "jsonData null";}switch ($arrayData['deviceType']) {case 'ceiling_lamp': {if ($arrayData['attribute'] == 'powerstate' || $arrayData['attribute'] == 'brightnessStep' || $arrayData['attribute'] == 'brightness' ) {//Full Support Request Actionreturn 'succeed';}if ($arrayData['attribute'] == 'mode' && $arrayData['value'] == '自然模式') {return 'succeed';}if ($arrayData['attribute'] == 'color' && ($arrayData['value'] == 'White' || $arrayData['value'] == 'Yellow')) {return 'succeed';}return 'failed';}break;case 'gateway_switch': {}break;default:break;}error_log('----control_checker out----');
}?>

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/54424.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【 安信可模组TG-12F/TG-01M①】AT指令入门教程 接入阿里飞燕/天猫精灵平台

文章目录 一. TG-12F概述二. 模组接线三、接入阿里飞燕平台1.功能定义2.人机交互3. 添加测试设备4. 发布产品5.设置五元组进入配网 注意&#xff0c;DeviceName必须是小写的MAC地址6. 数据上报下发 四、接入天猫精灵平台 一. TG-12F概述 TG-12F/TG-01M模块采用天猫精灵TG7100C芯…

天猫精灵对接3 (具体代码实现)

1.有什么协议问题&#xff0c;请先看对接文档 2.基础流程请看上一篇文章&#xff0c;已经讲得比较详细了。 3.代码写得渣&#xff0c;有什么可以优化的地方麻烦提一下&#xff0c;喷我也没啥用。 运行&#xff08;调试&#xff09;流程&#xff1a; 本机测试&#xff08;内网模…

什么样的量化交易策略才是最有用的?

一、什么是交易策略&#xff1f; 交易策略是一系列规则的集合&#xff0c;包括进场和出场的条件&#xff0c;资金管理和风险控制等。策略有简单和复杂之分&#xff0c;简单的策略通常使用技术指标和价格行为&#xff0c;复杂的策略使用高阶数学和统计模型。 通常情况下&#x…

虚拟信用卡绑定paypal验证的教程

用于PayPal验证的虚拟卡教程 如果您的卡无法添加到您的paypal中。您必须需要联系支持才能知道您的账单地址和邮政编码。您可以使用银行卡设置自己的Paypal帐单邮寄地址。 1.使用可用的付款方式 2.使用您的PayPal帐户中提供的相同名称和地址注册卡。 3.登录到您的PayPal帐户并转…

银行卡号返回银行信息

支付宝的开放API, 银行卡校验接口 接口URL https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charsetutf-8&cardNo6230580000354174000&cardBinChecktrue 请求方式 GET 请求Query参数 参数名示例值参数类型是否必填参数描述_input_charsetutf-8Str…

如何提升APP端银行卡绑卡效率,应用移动端银行卡识别接口

随着互联网浪潮的推进&#xff0c;网上购物已不再稀奇&#xff0c;而作为线上支付的前提——绑定银行卡是必不可少的。但是五花八门的购物APP绑卡时都得一个一个的输入银行卡号是极不方便的&#xff0c;慢还容易出错。随着机器学习和人工智能的飞速发展&#xff0c;在计算机视觉…

根据银行卡号获取开户行及银行卡类型的demo(python、android 和ios)

最近更新了一个项目&#xff1a;关于银行卡匹(根据银行卡号获取开户行以及银行卡类型等信息)。 CSDN下载地址:https://download.csdn.net/download/wy363681759/10724995 ###背景&#xff1a; 当前网络上流传的较多的关于这俄中需求的工具类&#xff0c;大都较为过时&#xff…

输入银行卡号,可以自动识别到银行卡类型的方法

根据银行卡号信息可以自动识别到银行卡类型 下载依赖&#xff1a;npm install bankcardinfo 使用方法&#xff1a; 1: var BIN require(‘bankcardinfo’); 2&#xff1a;调用:两个参数&#xff0c;一个是卡号&#xff0c;一个是报错&#xff0c;以及返回的信息 BIN.getBank…

APP嵌入手机拍照银行卡识别接口,实现快速绑定银行卡号

受支付宝银行卡识别的启发&#xff0c;腾讯随后在微信、QQ中添加银行卡识别功能&#xff0c;通过技术上的创新提升用户支付的体验&#xff0c;均得到用户的肯定。为此&#xff0c;更多的行业用户希望在其业务系统中集成手机拍照银行卡识别功能&#xff0c;比如&#xff1a;证券…

九龙证券|避险情绪升温,黄金上破2000大关,概念股逆市大涨

A股今天早盘强势拉升&#xff0c;午后回落走低&#xff0c;两市成交额时隔1个月再度打破万亿&#xff1b;港股大幅跳水&#xff0c;恒生指数一度跌超3%。 详细来看&#xff0c;A股方面&#xff0c;三大股指早盘震动走高&#xff0c;午后在酿酒、金融等板块的拖累下回落。到收盘…

工业企业如何降费减负?度能智能电费优化了解一下

工业企业如何降费减负&#xff1f;度能智能电费优化了解一下 原文链接&#xff1a;https://www.idcs.cn/a/v2341 工业企业福利来啦&#xff01;工厂用电容量经常用不满&#xff0c;资源浪费&#xff0c;成本增加。百度新推出度能智能电费优化服务&#xff0c;也叫智能电网用电…

预付费系统中电费电价管理的分析与应用

0引言 随着自动化控制技术的不断完善&#xff0c;自动化系统已经可以在许多方面熟练的掌握人工需要做的操作。在电费电价管理中&#xff0c;自动抄表就有着人工远不能及的数据收集能力&#xff0c;而且自动抄表还有着成本低、不易出错率的好处。但近些年随着电力企业不断扩充用…

内蒙古电力交易对数据中心用电费用的影响分析

内蒙古电力交易对数据中心用电费用的影响分析 从北京往西北方向出发&#xff0c;沿着京藏高速驱车约5个小时&#xff0c;经过张家口&#xff0c;即可到达中国的“草原云谷”-内蒙古自治区乌兰察布市。凭借着优越的地理位置&#xff0c;全年平均气温4.3摄氏度、盛夏的平均气温18…

数据中心太废电?为省电费阿里和微软是这么做的....

数据中心是个非常耗电的庞大的家伙&#xff0c;据《中国数据中心能耗现状白皮书》显示&#xff0c;2015年数据中心的电耗达1000亿度&#xff0c;年耗电量超过全社会用电量的1.5%。在美国&#xff0c;2013年数据中心领域总用电量就达到恐怖的910亿度。同时据调研&#xff0c;至2…

电费计算

代码如下&#xff1a; import java.util.Scanner; public class Record { double lastRecord;//上月用电数 double curentRecod;//本月用电数 double usedAmount;//本月用电量 double usedFee;//本月电费 //获取上月和本月的用电数 public void setRcord() { Scanner scannew S…

2023开年第一涨!有省市IDC电费拟环比上浮23.41 %

2022年的最后几天&#xff0c;两大电网各省市公司再一次更新了代理购电工商业用户电价表&#xff0c;这意味着绝大部分数据中心即将引来“电费2023开年第一涨”。 “1439号文件”&#xff08;《关于进一步深化燃煤发电上网电价市场化改革的通知(发改价格〔2021〕1439号》&#…

1元课,学会小学数学应用题,你的孩子也能秒解“鸡兔同笼”

要说小学时遇到头疼的数学题有哪些&#xff1f;“鸡兔同笼”一定是其中之一。最近微博上有一个三岁的宝宝&#xff0c;在没人教的情况下&#xff0c;凭着自己逻辑清晰的计算思路解答出来。 对此&#xff0c;网友们在微博下纷纷留言&#xff0c;比如这位宝妈就说道&#xff1a; …

懒人版小学生1-6年级计算题练习(口算练习)可直接电脑上答题或者打印题目

[懒人版]小学生1-6年级计算题练习 欢迎使用软件编程语言软件功能软件操作流程下载地址软件使用到的工具 欢迎使用 网上众多小学生计算题练习&#xff08;小学生口算练习&#xff09;软件使用起来都不是很方便。网上现有类型基本上要么只能在电脑上答题&#xff0c;要么生成doc…

Math数学工具类练习:小学数学题

题目&#xff1a;计算在-10.8到5.9之间&#xff0c;绝对值大于6或者小于2.1的整数有多少个&#xff1f; 分析&#xff1a;1.确定了范围。for循环 2.起点位置-10.8应该转换为-10 ①可以使用Math.ceil方法&#xff0c;向上&#xff08;向正方向&#xff09;取整 ②强制转换成int&…

[GDKOI2016]小学生数学题

[GDKOI2016]小学生数学题 题意&#xff1a;给定n、p、k&#xff0c;求 ∑ i 1 n 1 i ( m o d p k ) \sum_{i1}^n \frac 1i(mod\ p^k) ∑i1n​i1​(mod pk) 思路&#xff1a;设 f ( n , k ) ∑ i 1 n 1 i ( m o d p k ) f(n,k)\sum_{i1}^n \frac 1i (mod\ p^k) f(n,k)∑i1n​…