sensor

package
v0.0.0-...-de2618e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RspController = "rsp-controller"
	GetBasicInfo  = "sensor_get_basic_info"
	GetDeviceIds  = "sensor_get_device_ids"
)
View Source
const (
	DefaultFacility = "DEFAULT_FACILITY"
)

Variables

This section is empty.

Functions

func ExecuteSensorCommand

func ExecuteSensorCommand(deviceId string, commandName string) (*models.Reading, error)

ExecuteSensorCommand makes an HTTP GET call to the EdgeX core command service to execute a specified command on a given RSP sensor

func QueryBasicInfo

func QueryBasicInfo(deviceId string) (*jsonrpc.SensorBasicInfo, error)

QueryBasicInfo makes a call to the EdgeX command service to request the RSP-Controller to return us more information about a given RSP sensor

func QueryBasicInfoAllSensors

func QueryBasicInfoAllSensors(dbs *sql.DB) error

QueryBasicInfoAllSensors retrieves the list of deviceIds from the RSP Controller and then queries the basic info for each one

func Upsert

func Upsert(dbs *sql.DB, rsp *RSP) error

Upsert takes a pointer to an rsp config and either adds it to the DB if it is new, or updates its values if it is existing

Types

type Personality

type Personality string
const (
	NoPersonality Personality = "NONE"
	Exit          Personality = "EXIT"
	POS           Personality = "POS"
	FittingRoom   Personality = "FITTING_ROOM"
)

type RSP

type RSP struct {
	DeviceId     string      `json:"device_id" db:"device_id"`
	FacilityId   string      `json:"facility_id" db:"facility_id"`
	Personality  Personality `json:"personality" db:"personality"`
	Aliases      []string    `json:"aliases" db:"aliases"`
	UpdatedOn    int64       `json:"updated_on" db:"updated_on"`
	IsInDeepScan bool        `json:"-" db:"-"`
}

func FindRSP

func FindRSP(dbs *sql.DB, deviceId string) (*RSP, error)

FindRSP searches DB for RSP based on the device_id value Returns the RSP if found or empty RSP if it does not exist

func GetOrCreateRSP

func GetOrCreateRSP(dbs *sql.DB, deviceId string) (*RSP, error)

GetOrCreateRSP returns a pointer to an RSP if found in the DB, and if not found in the DB, a record will be created and added, then returned to the caller error is only non-nil when there is an issue communicating with the DB

func NewRSP

func NewRSP(deviceId string) *RSP

func NewRSPFromConfigNotification

func NewRSPFromConfigNotification(notification *jsonrpc.SensorConfigNotification) *RSP

func (*RSP) AntennaAlias

func (rsp *RSP) AntennaAlias(antennaId int) string

AntennaAlias gets the string alias of an RSP based on the antenna port format is DeviceId-AntennaId, ie. RSP-150009-0 If there is an alias defined for that antenna port, use that instead Note that each antenna port is supposed to refer to that index in the rsp.Aliases slice

func (*RSP) IsExitSensor

func (rsp *RSP) IsExitSensor() bool

IsExitSensor returns true if this RSP has the EXIT personality

func (*RSP) IsPOSSensor

func (rsp *RSP) IsPOSSensor() bool

IsPOSSensor returns true if this RSP has the POS personality

func (*RSP) Scan

func (rsp *RSP) Scan(value interface{}) error

Scan implements sql.Scanner interfaces

func (*RSP) Value

func (rsp *RSP) Value() (driver.Value, error)

Value implements driver.Valuer interfaces

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL