Skip to content

Commit

Permalink
fixed sampling period for pulse 4
Browse files Browse the repository at this point in the history
  • Loading branch information
cpoder committed Nov 9, 2023
1 parent 3b28a50 commit b79e433
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nodejs/lora-codec-adeunis/src/AdeunisCodec.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class TestCodec extends AdeunisCodec {
testDecode(model: string, payload: string): C8YData {
let mo: Partial<IManagedObject> = {
id: "test",
c8y_RequiredAvailability: { responseInterval: 10 },
samplingPeriod: 10,
};
return this._decode(null, mo, model, 1, new Date(), payload);
}
Expand Down
10 changes: 5 additions & 5 deletions nodejs/lora-codec-adeunis/src/AdeunisCodec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class AdeunisCodec extends DeviceCodec {
(result.type?.includes("0x5a") || result.type?.includes("0x5b")) &&
result.counterValues
) {
if (!mo.c8y_RequiredAvailability?.responseInterval) {
if (!mo.samplingPeriod) {
console.error("Device must first retrieve its configuration.");
}
let channel = "Channel A";
Expand All @@ -111,15 +111,15 @@ export class AdeunisCodec extends DeviceCodec {
channel,
"",
c,
new Date(
time.getTime() -
mo["c8y_RequiredAvailability"]["responseInterval"] * i * 60000
)
new Date(time.getTime() - mo.samplingPeriod * i * 60000)
);
});
}
if (result.type?.includes("configuration")) {
mo["c8y_Configuration"] = { config: JSON.stringify(result) };
if (result.samplingPeriod) {
mo.samplingPeriod = result.samplingPeriod;
}
if (result.calculatedSendingPeriod) {
let requiredAvailability: number = result.calculatedSendingPeriod.value;
if (result.calculatedSendingPeriod.unit === "s") {
Expand Down

0 comments on commit b79e433

Please sign in to comment.