mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-06-13 04:58:09 +00:00
Add option for auto-detect measurements.
In case the decoded payload contains random keys the auto-detect measurements feature will add new measurements for each uplink. With this option it is possible to turn auto-detection off to avoid polluting the database with many measurements. Closes #42.
This commit is contained in:
4
api/js/api/device_profile_pb.d.ts
vendored
4
api/js/api/device_profile_pb.d.ts
vendored
@ -87,6 +87,9 @@ export class DeviceProfile extends jspb.Message {
|
||||
clearTagsMap(): void;
|
||||
getMeasurementsMap(): jspb.Map<string, Measurement>;
|
||||
clearMeasurementsMap(): void;
|
||||
getAutoDetectMeasurements(): boolean;
|
||||
setAutoDetectMeasurements(value: boolean): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): DeviceProfile.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: DeviceProfile): DeviceProfile.AsObject;
|
||||
@ -126,6 +129,7 @@ export namespace DeviceProfile {
|
||||
abpRx2Freq: number,
|
||||
tagsMap: Array<[string, string]>,
|
||||
measurementsMap: Array<[string, Measurement.AsObject]>,
|
||||
autoDetectMeasurements: boolean,
|
||||
}
|
||||
}
|
||||
|
||||
|
31
api/js/api/device_profile_pb.js
vendored
31
api/js/api/device_profile_pb.js
vendored
@ -100,7 +100,8 @@ proto.api.DeviceProfile.toObject = function(includeInstance, msg) {
|
||||
abpRx2Dr: msg.getAbpRx2Dr(),
|
||||
abpRx2Freq: msg.getAbpRx2Freq(),
|
||||
tagsMap: (f = msg.getTagsMap(true)) ? f.toArray() : [],
|
||||
measurementsMap: (f = msg.getMeasurementsMap(true)) ? f.toArray() : []
|
||||
measurementsMap: (f = msg.getMeasurementsMap(true)) ? f.toArray() : [],
|
||||
autoDetectMeasurements: msg.getAutoDetectMeasurements()
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
@ -249,6 +250,10 @@ proto.api.DeviceProfile.deserializeBinaryFromReader = function(msg, reader) {
|
||||
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.api.Measurement.deserializeBinaryFromReader);
|
||||
});
|
||||
break;
|
||||
case 28:
|
||||
var value = /** @type {boolean} */ (reader.readBool());
|
||||
msg.setAutoDetectMeasurements(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
@ -470,6 +475,13 @@ proto.api.DeviceProfile.prototype.serializeBinaryToWriter = function (writer) {
|
||||
if (f && f.getLength() > 0) {
|
||||
f.serializeBinary(27, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.api.Measurement.serializeBinaryToWriter);
|
||||
}
|
||||
f = this.getAutoDetectMeasurements();
|
||||
if (f) {
|
||||
writer.writeBool(
|
||||
28,
|
||||
f
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -891,6 +903,23 @@ proto.api.DeviceProfile.prototype.getMeasurementsMap = function(opt_noLazyCreate
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional bool auto_detect_measurements = 28;
|
||||
* Note that Boolean fields may be set to 0/1 when serialized from a Java server.
|
||||
* You should avoid comparisons like {@code val === true/false} in those cases.
|
||||
* @return {boolean}
|
||||
*/
|
||||
proto.api.DeviceProfile.prototype.getAutoDetectMeasurements = function() {
|
||||
return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 28, false));
|
||||
};
|
||||
|
||||
|
||||
/** @param {boolean} value */
|
||||
proto.api.DeviceProfile.prototype.setAutoDetectMeasurements = function(value) {
|
||||
jspb.Message.setField(this, 28, value);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
|
4
api/js/api/device_profile_template_pb.d.ts
vendored
4
api/js/api/device_profile_template_pb.d.ts
vendored
@ -91,6 +91,9 @@ export class DeviceProfileTemplate extends jspb.Message {
|
||||
clearTagsMap(): void;
|
||||
getMeasurementsMap(): jspb.Map<string, api_device_profile_pb.Measurement>;
|
||||
clearMeasurementsMap(): void;
|
||||
getAutoDetectMeasurements(): boolean;
|
||||
setAutoDetectMeasurements(value: boolean): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): DeviceProfileTemplate.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: DeviceProfileTemplate): DeviceProfileTemplate.AsObject;
|
||||
@ -131,6 +134,7 @@ export namespace DeviceProfileTemplate {
|
||||
abpRx2Freq: number,
|
||||
tagsMap: Array<[string, string]>,
|
||||
measurementsMap: Array<[string, api_device_profile_pb.Measurement.AsObject]>,
|
||||
autoDetectMeasurements: boolean,
|
||||
}
|
||||
}
|
||||
|
||||
|
31
api/js/api/device_profile_template_pb.js
vendored
31
api/js/api/device_profile_template_pb.js
vendored
@ -96,7 +96,8 @@ proto.api.DeviceProfileTemplate.toObject = function(includeInstance, msg) {
|
||||
abpRx2Dr: msg.getAbpRx2Dr(),
|
||||
abpRx2Freq: msg.getAbpRx2Freq(),
|
||||
tagsMap: (f = msg.getTagsMap(true)) ? f.toArray() : [],
|
||||
measurementsMap: (f = msg.getMeasurementsMap(true)) ? f.toArray() : []
|
||||
measurementsMap: (f = msg.getMeasurementsMap(true)) ? f.toArray() : [],
|
||||
autoDetectMeasurements: msg.getAutoDetectMeasurements()
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
@ -249,6 +250,10 @@ proto.api.DeviceProfileTemplate.deserializeBinaryFromReader = function(msg, read
|
||||
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.api.Measurement.deserializeBinaryFromReader);
|
||||
});
|
||||
break;
|
||||
case 29:
|
||||
var value = /** @type {boolean} */ (reader.readBool());
|
||||
msg.setAutoDetectMeasurements(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
@ -477,6 +482,13 @@ proto.api.DeviceProfileTemplate.prototype.serializeBinaryToWriter = function (wr
|
||||
if (f && f.getLength() > 0) {
|
||||
f.serializeBinary(28, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.api.Measurement.serializeBinaryToWriter);
|
||||
}
|
||||
f = this.getAutoDetectMeasurements();
|
||||
if (f) {
|
||||
writer.writeBool(
|
||||
29,
|
||||
f
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -913,6 +925,23 @@ proto.api.DeviceProfileTemplate.prototype.getMeasurementsMap = function(opt_noLa
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional bool auto_detect_measurements = 29;
|
||||
* Note that Boolean fields may be set to 0/1 when serialized from a Java server.
|
||||
* You should avoid comparisons like {@code val === true/false} in those cases.
|
||||
* @return {boolean}
|
||||
*/
|
||||
proto.api.DeviceProfileTemplate.prototype.getAutoDetectMeasurements = function() {
|
||||
return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 29, false));
|
||||
};
|
||||
|
||||
|
||||
/** @param {boolean} value */
|
||||
proto.api.DeviceProfileTemplate.prototype.setAutoDetectMeasurements = function(value) {
|
||||
jspb.Message.setField(this, 29, value);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
|
Reference in New Issue
Block a user