机器人参数
获取机器人SN
发送参数
说明 :
| 参数 | 类型 | 必需 | 参数说明 |
| command | string | 是 | 操作指令 getRobotSn :获取SN |
| text | Object | 是 | get the robot sn |
| params | Object | 否 |
示例
程序示例:
/**
* 测试发送一个 “获取机器人SN” 指令, opk demo 中收到播放指令,会将指令通过 MRobotMessenger 再回传回来
*/
Log.i("关键点", "获取 robot sn");
JSONObject json = new JSONObject();
json.put("command", "getRobotSn");
json.put("text", "get the robot sn");
RobotMessengerManager.INSTANCE.triggerCommand(json.toString());
数据示例:
{
"command": "getRobotSn",
"text": "get the robot sn",
"params": ""
}
接受参数
说明:
| 参数 | 类型 | 必需 | 参数说明 |
| command | string | 是 | 结果值: “getRobotSn” |
| text | string | 否 | get the robot sn |
| code | number | 是 | 默认:1 |
| message | string | 是 | 机器人SN信息 |
示例
程序示例:
MRobotMessenger.getInstance().setRobotCallback(new MRobotMessenger.RobotCallback() {
@Override
public void onResult(String result) {
Log.i("SHADOW_OPK", "收取callback内容getRobotSnListener: " + result);
}
});
数据:
{
"command": "getRobotSn",
"text": "get the robot sn",
"code": 1,
"message": "MC1BCNA010021903NE05"
}
设置语音识别角度
发送参数
说明 :
| 参数 | 类型 | 必需 | 参数说明 |
| command | string | 是 | 操作指令 setVoiceRecognitionArea:设置机器人语音识别角度与范围 |
| centerAngle | float | 是 | 语音识别中心角度,范围 [0, 360) |
| rangeAngle | float | 是 | 区间角度,范围 [0, 120] |
| text | Object | 是 | set angle center range |
| params | Object | 否 |
示例
程序示例:
/**
* 测试发送一个播 “设置语音识别角度” 指令, opk demo 中收到播放指令,会将指令通过 MRobotMessenger 再回传回来
*/
Log.i("关键点", "设置语音识别区域");
JSONObject json = new JSONObject();
json.put("command", "setVoiceRecognitionArea");
json.put("centerAngle", 359.0);
json.put("rangeAngle", 120.0);
json.put("text", "set angle center range");
RobotMessengerManager.INSTANCE.triggerCommand(json.toString());
数据示例:
{
"command": "setVoiceRecognitionArea",
"centerAngle": 359.0,
"rangeAngle": 120.0,
"text": "set angle center range",
"params": ""
}
接受参数
说明:
| 参数 | 类型 | 必需 | 参数说明 |
| command | string | 是 | 结果值: “setVoiceRecognitionArea” |
| text | string | 否 | set angle center range |
| code | number | 是 | 默认:1 |
| message | string | 是 | 设置声音识别区域 |
示例
程序示例:
MRobotMessenger.getInstance().setRobotCallback(new MRobotMessenger.RobotCallback() {
@Override
public void onResult(String result) {
Log.i("SHADOW_OPK", "收取callback内容getRobotSnListener: " + result);
}
});
数据:
{
"command": "setVoiceRecognitionArea",
"text": "set angle center range",
"code": 1,
"message": "设置声音识别区域"
}