M2M

标准消息透传

/**
 * 指令下发
 *
 * @param params     指令集,即产品功能中标准功能/自定义功能属性功能标识
 * @param productKey 产品key
 * @param deviceName 设备名称
 * @param serviceId  服务Id,即产品功能中标准功能/自定义功能服务功能标识
 * @param isAsync    异步接收回调,回调信息将通过feedback返回
 * @param calback    结果回调
 * @throws XIotException
 * @throws JSONException
 */
public void XIotMqttClient.getInstance().publishCommands(HashParam params, String productKey, String deviceName, String serviceId, boolean isAsync, RequestCommandCallBack calback)

代码示例

HashParam params = new HashParam();
params.putParam("sourceProductKey", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
params.putParam("sourceDeviceName", "notice_source_aaa");
params.putParam("targetProductKey", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB");
params.putParam("targetDeviceName", "notice_target_bbb");

XIotMqttClient.getInstance().publishCommands(params, getString(R.string.productKey_edit), getString(R.string.deviceName_edit), "sss", false, new RequestCommandCallBack() {
    @Override
    public void onSuccess(String data, int status) {
        //   showTip("status:"+status+",data:"+data);
        Log.e(this.getClass().getCanonicalName(),"status:"+status+",data:"+data);
    }

    @Override
    public void onError(String error, int errorCode) {
        Log.e(this.getClass().getCanonicalName(),"sendMessageError:" + errorCode + ",error:" + error);
    }
});

results matching ""

    No results matching ""