Skip to content

Commit

Permalink
fix(nrplus): remove tx power
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Oct 27, 2023
1 parent 8ddd351 commit e0db4c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
23 changes: 3 additions & 20 deletions lambda/parseSinkMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,9 @@ const parserInstance = parser([PCCLines, PDCLines])
parserInstance.onMessage((deviceId, message) => {
console.log(JSON.stringify({ deviceId, message }))
if (isPCCInfo(message)) {
void iotData.send(
new UpdateThingShadowCommand({
thingName: deviceId,
payload: Buffer.from(
JSON.stringify({
state: {
reported: {
id: parseFloat(message.receiverId),
networkId: parseFloat(message.networkId),
nodes: {
[message.transmitterId]: {
txPowerDBm: parseFloat(message.txPowerDBm),
},
},
},
},
}),
),
}),
)
void updateNodeData(deviceId, message.transmitterId, {
pccStatus: message.status,
})
} else if (isPDCInfo(message)) {
const buttonPressed = buttonPressRegExp.exec(message.sduData)
if (buttonPressed !== null) {
Expand Down
6 changes: 4 additions & 2 deletions nrplus/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The content of the PDUs in here are just fMAC specific.
*/

/**
* PDC: Physical Data Channel
*
* Describes any messages received from any node within the network.
* The RSSI here only applies to the last link.
* We can use these messages to build an inventory of all of the nodes in the
Expand Down Expand Up @@ -53,8 +55,7 @@ export const isPDCInfo = (
): message is PDCInfo => 'sduData' in message

/**
* Describes a direct connection between the sink an a leaf or a relay, so we
* can use txPowerDBm to describe the link quality.
* PCC: Physical Control Channel
*/
export type PCCInfo = {
time: string // e.g. '365111832209'
Expand All @@ -65,6 +66,7 @@ export type PCCInfo = {
transmitterId: string // e.g. '39'
receiverId: string // e.g. '38'
MCS: string // e.g. '0'
// This is the signal strength between this node and the relay, which is not necessarily the transmitterId
txPowerDBm: string // e.g. '-12'
}

Expand Down

0 comments on commit e0db4c7

Please sign in to comment.