Closed hendyzone closed 2 years ago
嗯,这块之前主要测试端侧和云端通路是否ok,这块我们会尽快调整,rrpc消息的回复动作交由业务层处理,调整好后再回复
com.tencent.iot.hub.device.android.core.mqtt.TXMqttConnection#publishRRPCToCloud
private Status publishRRPCToCloud(Object userContext, String processId, Map<String, String> replyMsg) { // 应答topic格式: $rrpc/txd/${ProductId}/${DeviceName}/${messageid} String topic = String.format("$rrpc/txd/%s/%s/%s", mProductId, mDeviceName, processId); //TODO 通过replyMsg构建mqtt messge MqttMessage message = new MqttMessage(); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("test-key", "test-value"); // for test for (Map.Entry<String, String> entrys : replyMsg.entrySet()) { jsonObject.put(entrys.getKey(), entrys.getValue()); } } catch (JSONException e) { TXLog.e(TAG, e, "pack json data failed!"); } message.setQos(TXMqttConstants.QOS0); message.setPayload(jsonObject.toString().getBytes()); return publish(topic, message ,userContext); }
主要是这段代码,这段测试代码是表示当前接口还不可用吗 还是基于什么考虑呢
这块已经修改了,可以在onMessageArrived回调里过滤rrpc消息,调用publishRRPCToCloud方法回复自定义内容
com.tencent.iot.hub.device.android.core.mqtt.TXMqttConnection#publishRRPCToCloud
private Status publishRRPCToCloud(Object userContext, String processId, Map<String, String> replyMsg) { // 应答topic格式: $rrpc/txd/${ProductId}/${DeviceName}/${messageid} String topic = String.format("$rrpc/txd/%s/%s/%s", mProductId, mDeviceName, processId); //TODO 通过replyMsg构建mqtt messge MqttMessage message = new MqttMessage(); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("test-key", "test-value"); // for test for (Map.Entry<String, String> entrys : replyMsg.entrySet()) { jsonObject.put(entrys.getKey(), entrys.getValue()); } } catch (JSONException e) { TXLog.e(TAG, e, "pack json data failed!"); } message.setQos(TXMqttConstants.QOS0); message.setPayload(jsonObject.toString().getBytes()); return publish(topic, message ,userContext); }
主要是这段代码,这段测试代码是表示当前接口还不可用吗 还是基于什么考虑呢
这块已经修改了,可以在onMessageArrived回调里过滤rrpc消息,调用publishRRPCToCloud方法回复自定义内容
好的 感谢
com.tencent.iot.hub.device.android.core.mqtt.TXMqttConnection#publishRRPCToCloud
主要是这段代码,这段测试代码是表示当前接口还不可用吗 还是基于什么考虑呢