Versions in this module Expand all Collapse all v1 v1.0.1 Jun 17, 2018 v1.0.0 May 28, 2018 Changes in this version + const DeviceProfileKeyTempl + const ModulationFSK + const ModulationLoRa + const RX1 + const RX2 + const ServiceProfileKeyTempl + const UplinkHistorySize + var ErrAlreadyExists = errors.New("object already exists") + var ErrDoesNotExist = errors.New("object does not exist") + var ErrDoesNotExistOrFCntOrMICInvalid = errors.New("device-session does not exist or invalid fcnt or mic") + var ErrInvalidAggregationInterval = errors.New("invalid aggregation interval") + var ErrInvalidName = errors.New("invalid gateway name") + func CreateDevice(db sqlx.Execer, d *Device) error + func CreateDeviceActivation(db sqlx.Queryer, da *DeviceActivation) error + func CreateDeviceProfile(db sqlx.Execer, dp *DeviceProfile) error + func CreateDeviceProfileCache(p *redis.Pool, dp DeviceProfile) error + func CreateDeviceQueueItem(db sqlx.Queryer, qi *DeviceQueueItem) error + func CreateGateway(db sqlx.Execer, gw *Gateway) error + func CreateGatewayProfile(db sqlx.Execer, c *GatewayProfile) error + func CreateMACCommandQueueItem(p *redis.Pool, devEUI lorawan.EUI64, block MACCommandBlock) error + func CreateRoutingProfile(db sqlx.Execer, rp *RoutingProfile) error + func CreateServiceProfile(db sqlx.Execer, sp *ServiceProfile) error + func CreateServiceProfileCache(p *redis.Pool, sp ServiceProfile) error + func DeleteDevice(db sqlx.Execer, devEUI lorawan.EUI64) error + func DeleteDeviceProfile(db sqlx.Execer, id string) error + func DeleteDeviceQueueItem(db sqlx.Execer, id int64) error + func DeleteDeviceSession(p *redis.Pool, devEUI lorawan.EUI64) error + func DeleteGateway(db sqlx.Execer, mac lorawan.EUI64) error + func DeleteGatewayProfile(db sqlx.Execer, id string) error + func DeleteMACCommandQueueItem(p *redis.Pool, devEUI lorawan.EUI64, block MACCommandBlock) error + func DeletePendingMACCommand(p *redis.Pool, devEUI lorawan.EUI64, cid lorawan.CID) error + func DeleteRoutingProfile(db sqlx.Execer, id string) error + func DeleteServiceProfile(db sqlx.Execer, id string) error + func DeviceSessionExists(p *redis.Pool, devEUI lorawan.EUI64) (bool, error) + func FlushDeviceProfileCache(p *redis.Pool, id string) error + func FlushDeviceQueueForDevEUI(db sqlx.Execer, devEUI lorawan.EUI64) error + func FlushMACCommandQueue(p *redis.Pool, devEUI lorawan.EUI64) error + func FlushServiceProfileCache(p *redis.Pool, id string) error + func GetGatewaysForMACs(db sqlx.Queryer, macs []lorawan.EUI64) (map[lorawan.EUI64]Gateway, error) + func GetMaxEmitAtTimeSinceGPSEpochForDevEUI(db sqlx.Queryer, devEUI lorawan.EUI64) (time.Duration, error) + func GetRandomDevAddr(p *redis.Pool, netID lorawan.NetID) (lorawan.DevAddr, error) + func HandleGatewayStatsPacket(db *common.DBLogger, stats gw.GatewayStatsPacket) error + func MustSetStatsAggregationIntervals(levels []string) + func SaveDeviceSession(p *redis.Pool, s DeviceSession) error + func SetPendingMACCommand(p *redis.Pool, devEUI lorawan.EUI64, block MACCommandBlock) error + func Transaction(db *common.DBLogger, f func(tx sqlx.Ext) error) error + func UpdateDevice(db sqlx.Execer, d *Device) error + func UpdateDeviceProfile(db sqlx.Execer, dp *DeviceProfile) error + func UpdateDeviceQueueItem(db sqlx.Execer, qi *DeviceQueueItem) error + func UpdateGateway(db sqlx.Execer, gw *Gateway) error + func UpdateGatewayProfile(db sqlx.Execer, c *GatewayProfile) error + func UpdateRoutingProfile(db sqlx.Execer, rp *RoutingProfile) error + func UpdateServiceProfile(db sqlx.Execer, sp *ServiceProfile) error + func ValidateAndGetFullFCntUp(s DeviceSession, fCntUp uint32) (uint32, bool) + func ValidateDevNonce(db sqlx.Queryer, joinEUI, devEUI lorawan.EUI64, nonce lorawan.DevNonce) error + type Device struct + CreatedAt time.Time + DevEUI lorawan.EUI64 + DeviceProfileID string + RoutingProfileID string + ServiceProfileID string + SkipFCntCheck bool + UpdatedAt time.Time + func GetDevice(db sqlx.Queryer, devEUI lorawan.EUI64) (Device, error) + func GetDevicesWithClassBOrClassCDeviceQueueItems(db sqlx.Ext, count int) ([]Device, error) + type DeviceActivation struct + CreatedAt time.Time + DevAddr lorawan.DevAddr + DevEUI lorawan.EUI64 + DevNonce lorawan.DevNonce + ID int64 + JoinEUI lorawan.EUI64 + NwkSKey lorawan.AES128Key + func GetLastDeviceActivationForDevEUI(db sqlx.Queryer, devEUI lorawan.EUI64) (DeviceActivation, error) + type DeviceProfile struct + CreatedAt time.Time + UpdatedAt time.Time + func GetAndCacheDeviceProfile(db sqlx.Queryer, p *redis.Pool, id string) (DeviceProfile, error) + func GetDeviceProfile(db sqlx.Queryer, id string) (DeviceProfile, error) + func GetDeviceProfileCache(p *redis.Pool, id string) (DeviceProfile, error) + type DeviceQueueItem struct + Confirmed bool + CreatedAt time.Time + DevEUI lorawan.EUI64 + EmitAtTimeSinceGPSEpoch *time.Duration + FCnt uint32 + FPort uint8 + FRMPayload []byte + ID int64 + IsPending bool + TimeoutAfter *time.Time + UpdatedAt time.Time + func GetDeviceQueueItem(db sqlx.Queryer, id int64) (DeviceQueueItem, error) + func GetDeviceQueueItemsForDevEUI(db sqlx.Queryer, devEUI lorawan.EUI64) ([]DeviceQueueItem, error) + func GetNextDeviceQueueItemForDevEUI(db sqlx.Queryer, devEUI lorawan.EUI64) (DeviceQueueItem, error) + func GetNextDeviceQueueItemForDevEUIMaxPayloadSizeAndFCnt(db sqlx.Ext, devEUI lorawan.EUI64, maxPayloadSize int, fCnt uint32, ...) (DeviceQueueItem, error) + func GetPendingDeviceQueueItemForDevEUI(db sqlx.Queryer, devEUI lorawan.EUI64) (DeviceQueueItem, error) + type DeviceSession struct + ADR bool + BeaconLocked bool + ChannelFrequencies []int + DR int + DevAddr lorawan.DevAddr + DevEUI lorawan.EUI64 + DeviceProfileID string + EnabledChannels []int + EnabledUplinkChannels []int + ExtraUplinkChannels map[int]band.Channel + FCntDown uint32 + FCntUp uint32 + JoinEUI lorawan.EUI64 + LastDevStatusBattery uint8 + LastDevStatusMargin int8 + LastDevStatusRequested time.Time + LastDownlinkTX time.Time + LastRXInfoSet models.RXInfoSet + MaxSupportedDR int + MaxSupportedTXPowerIndex int + MinSupportedTXPowerIndex int + NbTrans uint8 + NwkSKey lorawan.AES128Key + PingSlotDR int + PingSlotFrequency int + PingSlotNb int + RX1DROffset uint8 + RX2DR uint8 + RX2Frequency int + RXDelay uint8 + RXWindow RXWindow + RoutingProfileID string + ServiceProfileID string + SkipFCntValidation bool + TXPowerIndex int + UplinkHistory []UplinkHistory + func GetDeviceSession(p *redis.Pool, devEUI lorawan.EUI64) (DeviceSession, error) + func GetDeviceSessionForPHYPayload(p *redis.Pool, phy lorawan.PHYPayload) (DeviceSession, error) + func GetDeviceSessionsForDevAddr(p *redis.Pool, devAddr lorawan.DevAddr) ([]DeviceSession, error) + func (s *DeviceSession) AppendUplinkHistory(up UplinkHistory) + func (s DeviceSession) GetPacketLossPercentage() float64 + type ExtraChannel struct + Bandwidth int + Bitrate int + Frequency int + Modulation string + SpreadingFactors []int64 + type GPSPoint struct + Latitude float64 + Longitude float64 + func (l *GPSPoint) Scan(src interface{}) error + func (l GPSPoint) Value() (driver.Value, error) + type Gateway struct + Altitude float64 + CreatedAt time.Time + Description string + FirstSeenAt *time.Time + GatewayProfileID *string + LastSeenAt *time.Time + Location GPSPoint + MAC lorawan.EUI64 + Name string + UpdatedAt time.Time + func GetGateway(db sqlx.Queryer, mac lorawan.EUI64) (Gateway, error) + func (g Gateway) Validate() error + type GatewayProfile struct + Channels []int64 + CreatedAt time.Time + ExtraChannels []ExtraChannel + GatewayProfileID string + UpdatedAt time.Time + func GetGatewayProfile(db sqlx.Queryer, id string) (GatewayProfile, error) + func (p GatewayProfile) GetVersion() string + type MACCommandBlock struct + CID lorawan.CID + External bool + MACCommands MACCommands + func GetMACCommandQueueItems(p *redis.Pool, devEUI lorawan.EUI64) ([]MACCommandBlock, error) + func GetPendingMACCommand(p *redis.Pool, devEUI lorawan.EUI64, cid lorawan.CID) (*MACCommandBlock, error) + func (m *MACCommandBlock) Size() (int, error) + type MACCommands []lorawan.MACCommand + func (m *MACCommands) UnmarshalBinary(data []byte) error + func (m MACCommands) MarshalBinary() ([]byte, error) + type RXWindow int8 + type RoutingProfile struct + CACert string + CreatedAt time.Time + TLSCert string + TLSKey string + UpdatedAt time.Time + func GetAllRoutingProfiles(db sqlx.Queryer) ([]RoutingProfile, error) + func GetRoutingProfile(db sqlx.Queryer, id string) (RoutingProfile, error) + type ServiceProfile struct + CreatedAt time.Time + UpdatedAt time.Time + func GetAndCacheServiceProfile(db sqlx.Queryer, p *redis.Pool, id string) (ServiceProfile, error) + func GetServiceProfile(db sqlx.Queryer, id string) (ServiceProfile, error) + func GetServiceProfileCache(p *redis.Pool, id string) (ServiceProfile, error) + type Stats struct + Interval string + MAC lorawan.EUI64 + RXPacketsReceived int + RXPacketsReceivedOK int + TXPacketsEmitted int + TXPacketsReceived int + Timestamp time.Time + func GetGatewayStats(db *common.DBLogger, mac lorawan.EUI64, interval string, start, end time.Time) ([]Stats, error) + type UplinkHistory struct + FCnt uint32 + GatewayCount int + MaxSNR float64 + TXPowerIndex int Incompatible versions in this module v2.5.0+incompatible Feb 14, 2019 v2.4.1+incompatible Dec 24, 2018 v2.4.0+incompatible Dec 24, 2018 v2.3.0+incompatible Oct 11, 2018 v2.2.0+incompatible Sep 13, 2018 v2.1.0+incompatible Aug 30, 2018 v2.0.2+incompatible Aug 15, 2018 v2.0.1+incompatible Aug 14, 2018 v2.0.0+incompatible Jul 30, 2018 v2.0.0-test.1+incompatible Jul 20, 2018 v2.0.0-alpha.1+incompatible Jul 3, 2018