Commit 4fc7668a727045614672b1aa12b4bcf73971c709

Authored by ShvaykaD
1 parent 699b2ef9

added default mqtt proto schemas

... ... @@ -133,8 +133,32 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control
133 133 private updateTransportPayloadBasedControls(type: MqttTransportPayloadType) {
134 134 const transportPayloadTypeConfigurationFormGroup = this.mqttDeviceProfileTransportConfigurationFormGroup.get('configuration.transportPayloadTypeConfiguration') as FormGroup;
135 135 if (type === MqttTransportPayloadType.PROTOBUF) {
136   - transportPayloadTypeConfigurationFormGroup.registerControl('deviceTelemetryProtoSchema', this.fb.control(null, Validators.required));
137   - transportPayloadTypeConfigurationFormGroup.registerControl('deviceAttributesProtoSchema', this.fb.control(null, Validators.required));
  136 + const defaultTelemetrySchema = "syntax =\"proto3\";\n" +
  137 + "package telemetry;\n" +
  138 + "\n" +
  139 + "message SensorDataReading {\n" +
  140 + "\n" +
  141 + " double temperature = 1;\n" +
  142 + " double humidity = 2;\n" +
  143 + " InnerObject innerObject = 3;\n" +
  144 + "\n" +
  145 + " message InnerObject {\n" +
  146 + " string key1 = 1;\n" +
  147 + " bool key2 = 2;\n" +
  148 + " double key3 = 3;\n" +
  149 + " int32 key4 = 4;\n" +
  150 + " string key5 = 5;\n" +
  151 + " }\n" +
  152 + "}\n";
  153 + const defaultAttributesSchema = "syntax =\"proto3\";\n" +
  154 + "package attributes;\n" +
  155 + "\n" +
  156 + "message SensorDataReading {\n" +
  157 + " string firmwareVersion = 1;\n" +
  158 + " string serialNumber = 2;\n" +
  159 + "}";
  160 + transportPayloadTypeConfigurationFormGroup.registerControl('deviceTelemetryProtoSchema', this.fb.control(defaultTelemetrySchema, Validators.required));
  161 + transportPayloadTypeConfigurationFormGroup.registerControl('deviceAttributesProtoSchema', this.fb.control(defaultAttributesSchema, Validators.required));
138 162 } else {
139 163 transportPayloadTypeConfigurationFormGroup.removeControl('deviceTelemetryProtoSchema');
140 164 transportPayloadTypeConfigurationFormGroup.removeControl('deviceAttributesProtoSchema');
... ...