api

package
v0.0.0-...-bd752d1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevEUILen  = 8
	GWIDLen    = 8
	DevAddrLen = 4
)

Variables

View Source
var ErrDuplicateApp = errors.New("duplicate application")
View Source
var ErrDuplicateDevice = errors.New("duplicate device")
View Source
var ErrDuplicateGateway = errors.New("duplicate gateway")
View Source
var ErrDuplicateNS = errors.New("duplicate network-server")

Functions

func GenerateDevAddr

func GenerateDevAddr() string

func GenerateDevEUI

func GenerateDevEUI() string

func GenerateGWID

func GenerateGWID() string

Types

type API

type API struct {
	Client   *resty.Client
	Username string
	Password string
}

API for accessing chirpstack.

func New

func New(cfg Config) API

func (API) Activate

func (a API) Activate(devEUI, devAddr, applicationSKey, networkSKey string) error

func (API) CreateApplication

func (a API) CreateApplication(name, description, orgID, spID string) error

func (API) CreateDevice

func (a API) CreateDevice(
	devEUI string,
	name string,
	applicationID int64,
	description string,
	deviceProfileID string,
	skipFCntCheck bool,
	referenceAlltitude float64,
	isDisabled bool,
) error

func (API) CreateDeviceProfile

func (a API) CreateDeviceProfile(name, orgID, nsID string) (string, error)

func (API) CreateGateway

func (a API) CreateGateway(id, name, description, orgID, nsID, spID string) error

func (API) CreateNetworkServer

func (a API) CreateNetworkServer(id, name, server string) error

func (API) CreateServiceProfile

func (a API) CreateServiceProfile(name, orgID, nsID string) (string, error)

func (API) GetOrCreateDeviceProfile

func (a API) GetOrCreateDeviceProfile(name, orgID, nsID string) (string, error)

func (API) GetOrCreateServiceProfile

func (a API) GetOrCreateServiceProfile(name, orgID, nsID string) (string, error)

func (*API) Login

func (a *API) Login()

type ActivationDeviceRequest

type ActivationDeviceRequest struct {
	DeviceActivation `json:"deviceActivation"`
}

type Application

type Application struct {
	Name             string `json:"name"`
	Description      string `json:"description"`
	OrganizationID   string `json:"organizationID"`   // nolint: tagliatelle
	ServiceProfileID string `json:"serviceProfileID"` // nolint: tagliatelle
}

type Config

type Config struct {
	URL      string `koanf:"url"`
	Username string `koanf:"username"`
	Password string `koanf:"password"`
}

type CreateApplicationRequest

type CreateApplicationRequest struct {
	Application `json:"application"`
}

type CreateDeviceProfileRequest

type CreateDeviceProfileRequest struct {
	DeviceProfile `json:"deviceProfile"`
}

type CreateDeviceProfileResponse

type CreateDeviceProfileResponse struct {
	ID string `json:"id"`
}

type CreateDeviceRequest

type CreateDeviceRequest struct {
	Device `json:"device"`
}

type CreateGatewayRequest

type CreateGatewayRequest struct {
	Gateway `json:"gateway"`
}

type CreateNetworkServerRequest

type CreateNetworkServerRequest struct {
	NetworkServer `json:"networkServer"`
}

type CreateServiceProfileRequest

type CreateServiceProfileRequest struct {
	ServiceProfile `json:"serviceProfile"`
}

type CreateServiceProfileResponse

type CreateServiceProfileResponse struct {
	ID string `json:"id"`
}

type Device

type Device struct {
	DevEUI            string            `json:"devEUI"` // nolint: tagliatelle
	Name              string            `json:"name"`
	ApplicationID     int64             `json:"applicationID"` // nolint: tagliatelle
	Description       string            `json:"description"`
	DeviceProfileID   string            `json:"deviceProfileID"` // nolint: tagliatelle
	SkipFCntCheck     bool              `json:"skipFCntCheck"`
	ReferenceAltitude float64           `json:"referenceAltitude"`
	Variables         map[string]string `json:"variables"`
	Tags              map[string]string `json:"tags"`
	IsDisabled        bool              `json:"isDisabled"`
}

type DeviceActivation

type DeviceActivation struct {
	DevEUI                      string `json:"devEUI"` // nolint: tagliatelle
	DevAddr                     string `json:"devAddr"`
	ApplicationSKey             string `json:"appSKey"`
	NetworkSEncKey              string `json:"nwkSEncKey"`
	ServingNetworkSIntKey       string `json:"sNwkSIntKey"`
	ForwardingNetworkSIntKey    string `json:"fNwkSIntKey"`
	UplinkFrameCounter          int    `json:"fCntUp"`
	DownlinkNetworkFrameCounter int    `json:"nFCntDown"`
	DownlinkAppFrameCounter     int    `json:"aFCntDown"`
}

type DeviceProfile

type DeviceProfile struct {
	ID                         string `json:"id"`
	Name                       string `json:"name"`
	OrganizationID             string `json:"organizationID"`  // nolint: tagliatelle
	NetworkServerID            string `json:"networkServerID"` // nolint: tagliatelle
	MACVersion                 string `json:"macVersion"`
	RegionalParametersRevision string `json:"regParamsRevision"`
	ADRAlgorithmID             string `json:"adrAlgorithmID"` // nolint: tagliatelle
	MaxEIRP                    int64  `json:"maxEIRP"`        // nolint: tagliatelle
	UplinekInterval            string `json:"uplinkInterval"`
}

type Gateway

type Gateway struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	Description      string   `json:"description"`
	OrganizationID   string   `json:"organizationID"` // nolint: tagliatelle
	DiscoveryEnabled bool     `json:"discoveryEnabled"`
	NetworkServerID  string   `json:"networkServerID"`  // nolint: tagliatelle
	ServiceProfileID string   `json:"serviceProfileID"` // nolint: tagliatelle
	Location         Location `json:"location"`
}

type ListDeviceProfileResponse

type ListDeviceProfileResponse struct {
	Result []DeviceProfile `json:"result"`
}

type ListServiceProfileResponse

type ListServiceProfileResponse struct {
	Result []ServiceProfile `json:"result"`
}

type Location

type Location struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Altitude  float64 `json:"altitude"`
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	JWT string `json:"jwt"`
}

type NetworkServer

type NetworkServer struct {
	ID                          string `json:"id"`
	Name                        string `json:"name"`
	Server                      string `json:"server"`
	GatewayDiscoveryEnabled     bool   `json:"gatewayDiscoveryEnabled"`
	GatewayDiscoveryInterval    int64  `json:"gatewayDiscoveryInterval"`
	GatewayDiscoveryTXFrequency int64  `json:"gatewayDiscoveryTXFrequency"` // nolint: tagliatelle
	GatewayDiscoveryDR          int64  `json:"gatewayDiscoveryDR"`          // nolint: tagliatelle
}

type ServiceProfile

type ServiceProfile struct {
	ID                 string `json:"id"`
	Name               string `json:"name"`
	OrganizationID     string `json:"organizationID"`  // nolint: tagliatelle
	NetworkServerID    string `json:"networkServerID"` // nolint: tagliatelle
	ULRate             int64  `json:"ulRate"`
	ULBucketSize       int64  `json:"ulBucketSize"`
	DLRate             int64  `json:"dlRate"`
	DLBucketSize       int64  `json:"dlBucketSize"`
	AddGatewayMetaData bool   `json:"addGWMetaData"` // nolint: tagliatelle
}

Jump to

Keyboard shortcuts

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