Change LR-FHSS code_rate to CodeRate type.

This commit is contained in:
Orne Brocaar
2022-07-22 12:19:36 +01:00
parent e7432986cd
commit c0a450c8f8
15 changed files with 805 additions and 658 deletions

15
api/js/gw/gw_pb.d.ts vendored
View File

@ -189,8 +189,11 @@ export class LrFhssModulationInfo extends jspb.Message {
getOperatingChannelWidth(): number;
setOperatingChannelWidth(value: number): void;
getCodeRate(): string;
setCodeRate(value: string): void;
getCodeRateLegacy(): string;
setCodeRateLegacy(value: string): void;
getCodeRate(): CodeRateMap[keyof CodeRateMap];
setCodeRate(value: CodeRateMap[keyof CodeRateMap]): void;
getGridSteps(): number;
setGridSteps(value: number): void;
@ -208,7 +211,8 @@ export class LrFhssModulationInfo extends jspb.Message {
export namespace LrFhssModulationInfo {
export type AsObject = {
operatingChannelWidth: number,
codeRate: string,
codeRateLegacy: string,
codeRate: CodeRateMap[keyof CodeRateMap],
gridSteps: number,
}
}
@ -1387,6 +1391,11 @@ export interface CodeRateMap {
CR_4_6: 2;
CR_4_7: 3;
CR_4_8: 4;
CR_3_8: 5;
CR_2_6: 6;
CR_1_4: 7;
CR_1_6: 8;
CR_5_6: 9;
}
export const CodeRate: CodeRateMap;

42
api/js/gw/gw_pb.js vendored
View File

@ -1393,6 +1393,7 @@ proto.gw.LrFhssModulationInfo.prototype.toObject = function(opt_includeInstance)
proto.gw.LrFhssModulationInfo.toObject = function(includeInstance, msg) {
var f, obj = {
operatingChannelWidth: msg.getOperatingChannelWidth(),
codeRateLegacy: msg.getCodeRateLegacy(),
codeRate: msg.getCodeRate(),
gridSteps: msg.getGridSteps()
};
@ -1437,6 +1438,10 @@ proto.gw.LrFhssModulationInfo.deserializeBinaryFromReader = function(msg, reader
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setCodeRateLegacy(value);
break;
case 4:
var value = /** @type {!proto.gw.CodeRate} */ (reader.readEnum());
msg.setCodeRate(value);
break;
case 3:
@ -1488,13 +1493,20 @@ proto.gw.LrFhssModulationInfo.prototype.serializeBinaryToWriter = function (writ
f
);
}
f = this.getCodeRate();
f = this.getCodeRateLegacy();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = this.getCodeRate();
if (f !== 0.0) {
writer.writeEnum(
4,
f
);
}
f = this.getGridSteps();
if (f !== 0) {
writer.writeUint32(
@ -1530,20 +1542,35 @@ proto.gw.LrFhssModulationInfo.prototype.setOperatingChannelWidth = function(valu
/**
* optional string code_rate = 2;
* optional string code_rate_legacy = 2;
* @return {string}
*/
proto.gw.LrFhssModulationInfo.prototype.getCodeRate = function() {
proto.gw.LrFhssModulationInfo.prototype.getCodeRateLegacy = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 2, ""));
};
/** @param {string} value */
proto.gw.LrFhssModulationInfo.prototype.setCodeRate = function(value) {
proto.gw.LrFhssModulationInfo.prototype.setCodeRateLegacy = function(value) {
jspb.Message.setField(this, 2, value);
};
/**
* optional CodeRate code_rate = 4;
* @return {!proto.gw.CodeRate}
*/
proto.gw.LrFhssModulationInfo.prototype.getCodeRate = function() {
return /** @type {!proto.gw.CodeRate} */ (jspb.Message.getFieldProto3(this, 4, 0));
};
/** @param {!proto.gw.CodeRate} value */
proto.gw.LrFhssModulationInfo.prototype.setCodeRate = function(value) {
jspb.Message.setField(this, 4, value);
};
/**
* optional uint32 grid_steps = 3;
* @return {number}
@ -10444,7 +10471,12 @@ proto.gw.CodeRate = {
CR_4_5: 1,
CR_4_6: 2,
CR_4_7: 3,
CR_4_8: 4
CR_4_8: 4,
CR_3_8: 5,
CR_2_6: 6,
CR_1_4: 7,
CR_1_6: 8,
CR_5_6: 9
};
/**