Added edge update config handler
This commit is contained in:
		
							parent
							
								
									8f5fefa0a0
								
							
						
					
					
						commit
						7644aa4342
					
				@ -83,6 +83,7 @@ import org.thingsboard.server.gen.edge.DeviceUpdateMsg;
 | 
			
		||||
import org.thingsboard.server.gen.edge.DownlinkMsg;
 | 
			
		||||
import org.thingsboard.server.gen.edge.DownlinkResponseMsg;
 | 
			
		||||
import org.thingsboard.server.gen.edge.EdgeConfiguration;
 | 
			
		||||
import org.thingsboard.server.gen.edge.EdgeUpdateMsg;
 | 
			
		||||
import org.thingsboard.server.gen.edge.EntityDataProto;
 | 
			
		||||
import org.thingsboard.server.gen.edge.EntityViewUpdateMsg;
 | 
			
		||||
import org.thingsboard.server.gen.edge.RelationRequestMsg;
 | 
			
		||||
@ -244,12 +245,11 @@ public final class EdgeGrpcSession implements Closeable {
 | 
			
		||||
    void onConfigurationUpdate(Edge edge) {
 | 
			
		||||
        try {
 | 
			
		||||
            this.edge = edge;
 | 
			
		||||
            // TODO: voba - push edge configuration update to edge
 | 
			
		||||
//            sendResponseMsg(org.thingsboard.server.gen.integration.ResponseMsg.newBuilder()
 | 
			
		||||
//                    .setIntegrationUpdateMsg(IntegrationUpdateMsg.newBuilder()
 | 
			
		||||
//                            .setConfiguration(constructIntegrationConfigProto(configuration, defaultConverterProto, downLinkConverterProto))
 | 
			
		||||
//                            .build())
 | 
			
		||||
//                    .build());
 | 
			
		||||
            EdgeUpdateMsg edgeConfig = EdgeUpdateMsg.newBuilder()
 | 
			
		||||
                    .setConfiguration(constructEdgeConfigProto(edge)).build();
 | 
			
		||||
            outputStream.onNext(ResponseMsg.newBuilder()
 | 
			
		||||
                    .setEdgeUpdateMsg(edgeConfig)
 | 
			
		||||
                    .build());
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.error("Failed to construct proto objects!", e);
 | 
			
		||||
        }
 | 
			
		||||
@ -903,7 +903,7 @@ public final class EdgeGrpcSession implements Closeable {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (uplinkMsg.getDeviceRpcCallMsgList() != null && !uplinkMsg.getDeviceRpcCallMsgList().isEmpty()) {
 | 
			
		||||
                for (DeviceRpcCallMsg deviceRpcCallMsg: uplinkMsg.getDeviceRpcCallMsgList()) {
 | 
			
		||||
                for (DeviceRpcCallMsg deviceRpcCallMsg : uplinkMsg.getDeviceRpcCallMsgList()) {
 | 
			
		||||
                    result.add(ctx.getDeviceProcessor().processDeviceRpcCallResponseMsg(edge.getTenantId(), deviceRpcCallMsg));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -114,6 +114,9 @@ public class EdgeGrpcClient implements EdgeRpcClient {
 | 
			
		||||
                        }
 | 
			
		||||
                        onError.accept(new EdgeConnectionException("Failed to establish the connection! Response code: " + connectResponseMsg.getResponseCode().name()));
 | 
			
		||||
                    }
 | 
			
		||||
                } else if (responseMsg.hasEdgeUpdateMsg()) {
 | 
			
		||||
                    log.debug("[{}] Edge update message received {}", edgeKey, responseMsg.getEdgeUpdateMsg());
 | 
			
		||||
                    onEdgeUpdate.accept(responseMsg.getEdgeUpdateMsg().getConfiguration());
 | 
			
		||||
                } else if (responseMsg.hasUplinkResponseMsg()) {
 | 
			
		||||
                    log.debug("[{}] Uplink response message received {}", edgeKey, responseMsg.getUplinkResponseMsg());
 | 
			
		||||
                    onUplinkResponse.accept(responseMsg.getUplinkResponseMsg());
 | 
			
		||||
 | 
			
		||||
@ -44,6 +44,7 @@ message ResponseMsg {
 | 
			
		||||
  ConnectResponseMsg connectResponseMsg = 1;
 | 
			
		||||
  UplinkResponseMsg uplinkResponseMsg = 2;
 | 
			
		||||
  DownlinkMsg downlinkMsg = 3;
 | 
			
		||||
  EdgeUpdateMsg edgeUpdateMsg = 4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
enum RequestMsgType {
 | 
			
		||||
@ -52,6 +53,10 @@ enum RequestMsgType {
 | 
			
		||||
  SYNC_REQUEST_RPC_MESSAGE = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message EdgeUpdateMsg {
 | 
			
		||||
  EdgeConfiguration configuration = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message ConnectRequestMsg {
 | 
			
		||||
  string edgeRoutingKey = 1;
 | 
			
		||||
  string edgeSecret = 2;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user