接口原型
public void getHealthData(String param, String function)
方法描述:查询设备历史数据。当前支持JS查询体温、血氧、体重、血糖、血压、跳绳数据。
请求参数
参数名称 |
参数类型 |
参数描述 |
可选选项 |
|---|---|---|---|
param |
String |
param 参数是一个json字符串。 startTime String 查询开始的UTC时间戳,精确到毫秒。 endTime String 查询结束的UTC时间戳,精确到毫秒。 type Number 数据类型。枚举值。 dataTypeName String 查询数据类型名称。 |
M |
queryKind int 查询数据方式,目前只支持在血糖数据查询中使用。 枚举值:0 表示全量查询,1 表示查询已确认数据,2 表示查询待确认数据。 |
O |
||
function |
String |
运动健康返回查询结果的回调函数,该回调函数有一个参数,详情参见响应参数。 |
M |
getHealthData: function (){
//查询设备历史数据
window.hilink.getHealthData('{
"startTime":startStamp,
"endTime":endStamp,
"type":10001,
"dataTypeName":"com.huawei.instantaneous.blood_glucose"
}','function');
}
function function(resultCode, data) {
var errCode = resultCode;
var sportData = data;
}
跳绳查询示例:
{
"startTime": 1488297600000L,
"endTime": 1888297600000L,
"type": 30029
}
响应参数
回调返回resultCode和JSON对象说明:
参数名称 |
参数类型 |
参数描述 |
可选选项 |
|---|---|---|---|
resultCode |
String |
处理结果码: 0:成功,其他失败 参见错误码清单。 |
M |
data |
String |
运动健康历史数据集。 |
M |
{
"resultCode": 0,
"data": [
{
"startTime":1460103581638,
"endTime:1460103581638,
"type":10001,
"dataTypeName":"",
"value":{
"beforeBreakfast": 4.5
}
}
]
}
跳绳查询结果数据
{
"resultCode": 0,
"type":30029,
"data":[
{
"startTime":1488297600000,
"endTime":1498397600000,
"value":{
"sportType":283,
"totalCalories":2000,
"totalTime":17000,
"mExtendTrackDataMap":{"skipSpeed":"226","skipNum":"64","stumblingRope":"1","maxSkippingTimes":"55"},
}
}
{...(如果多条会并排列出来)}
]
}