Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correct parsing of ImpinjPeakRSSI parameter #44

Merged
merged 1 commit into from
Jul 28, 2021

Conversation

ajcasagrande
Copy link
Contributor

Signed-off-by: Anthony Casagrande anthony.j.casagrande@intel.com

PR Type

What kind of change does this PR introduce?

  • Bugfix

Other information

Fixed a typo. ImpinjEnablePeakRSSI is what you send to turn on reporting of that value. ImpinjPeakRSSI is the actual subtype of the reported parameter. Verified working on my SpeedwayR420 RFID reader.

@ajcasagrande
Copy link
Contributor Author

ajcasagrande commented Jul 27, 2021

Definitions:

const (
ImpinjEnablePeakRSSI = ImpinjParamSubtype(53)
ImpinjPeakRSSI = ImpinjParamSubtype(57)

Verification:

for _, c := range rt.Custom {
    fmt.Printf("Got Custom -- vendor: %s (%d), subtype: %s (%d)\n",
	    VendorPEN(c.VendorID).String(), c.VendorID, ImpinjParamSubtype(c.Subtype).String(), c.Subtype)
    if c.Is(PENImpinj, ImpinjPeakRSSI) && len(c.Data) == 2 {
	    fmt.Printf("Got ImpinjPeakRSSI: %v\n", float64(int16(binary.BigEndian.Uint16(c.Data))) / 100.0)
	    return float64(int16(binary.BigEndian.Uint16(c.Data))) / 100.0, true // dBm x100
    }
}
Got Custom -- vendor: PENImpinj (25882), subtype: ImpinjPeakRSSI (57)
Got ImpinjPeakRSSI: -19.5
Got Custom -- vendor: PENImpinj (25882), subtype: ImpinjPeakRSSI (57)
Got ImpinjPeakRSSI: -24
Got Custom -- vendor: PENImpinj (25882), subtype: ImpinjPeakRSSI (57)
Got ImpinjPeakRSSI: -23.5
Got Custom -- vendor: PENImpinj (25882), subtype: ImpinjPeakRSSI (57)
Got ImpinjPeakRSSI: -19.5
Got Custom -- vendor: PENImpinj (25882), subtype: ImpinjPeakRSSI (57)
Got ImpinjPeakRSSI: -24.5
Got Custom -- vendor: PENImpinj (25882), subtype: ImpinjPeakRSSI (57)
Got ImpinjPeakRSSI: -23.5

Signed-off-by: Anthony Casagrande <anthony.j.casagrande@intel.com>

fix: update unit test for ImpinjPeakRSSI

Signed-off-by: Anthony Casagrande <anthony.j.casagrande@intel.com>
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ajcasagrande ajcasagrande merged commit 0853f1f into edgexfoundry:main Jul 28, 2021
@ajcasagrande ajcasagrande deleted the impinj-rssi-patch branch July 28, 2021 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants