model

package
v0.0.0-...-415f32b Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MODE_JS8                    = "js8"
	EVENT_TYPE_RX_ACTIVITY      = "RX.ACTIVITY"
	EVENT_TYPE_RX_DIRECTED      = "RX.DIRECTED"
	EVENT_TYPE_RX_DIRECTED_ME   = "RX.DIRECTED.ME"
	EVENT_TYPE_RX_SPOT          = "RX.SPOT"
	EVENT_TYPE_RIG_PTT          = "RIG.PTT"
	EVENT_TYPE_TX_FRAME         = "TX.FRAME"
	EVENT_TYPE_RIG_STATUS       = "RIG.STATUS"
	EVENT_TYPE_STATION_STATUS   = "STATION.STATUS"
	EVENT_TYPE_STATION_INFO     = "STATION.INFO"
	EVENT_TYPE_STATION_CALLSIGN = "STATION.CALLSIGN"
	EVENT_TYPE_STATION_GRID     = "STATION.GRID"

	// event types as seen in Websocket communication
	WS_EVENT_TYPE_RIG_PTT      = "RIG.PTT"
	WS_EVENT_TYPE_RIG_STATUS   = "RIG.STATUS"
	WS_EVENT_TYPE_STATION_INFO = "STATION.INFO"
	WS_OBJ_TYPE_RX_PACKET      = "RX.PACKET"
	WS_OBJ_TYPE_RX_SPOT        = "RX.SPOT"
	WS_OBJ_TYPE_TX_FRAME       = "TX.FRAME"
	WS_OBJ_TYPE_OTHER          = "OTHER"
)
View Source
var (
	SQL_RX_PACKET_INSERT      = "" /* 225-byte string literal not displayed */
	SQL_RX_PACKET_LIST_AFTER  = "" /* 332-byte string literal not displayed */
	SQL_RX_PACKET_LIST_BEFORE = "" /* 367-byte string literal not displayed */
)
View Source
var (
	SQL_RX_SPOT_INSERT    = "" /* 126-byte string literal not displayed */
	SQL_RX_SPOT_LIST_DAYS = "SELECT date(`TIMESTAMP`) FROM `RX_SPOT` ORDER BY date(`TIMESTAMP`) LIMIT ? OFFSET ?"
)
View Source
var (
	SQL_STATION_INFO_INSERT        = "INSERT INTO `STATION_INFO` (`TIMESTAMP`, `LATEST`, `CALL`, `GRID`, `INFO`, `STATUS`) values(?, ?, ?, ?, ?, ?)"
	SQL_STATION_INFO_UPDATE_LATEST = "UPDATE `STATION_INFO` SET `LATEST` = 0 WHERE `LATEST` = 1 AND `ID` != ?"
	SQL_STATION_INFO_FETCH_LATEST  = "SELECT * FROM `STATION_INFO` WHERE `LATEST` = 1"
)
View Source
var (
	DEFAULT_ADMIN_USERNAME = "admin"
	DEFAULT_ADMIN_PASSWORD = "admin"

	ROLE_ADMIN    = "admin"
	ROLE_MONITOR  = "monitor"
	ROLE_OPERATOR = "operator"
)
View Source
var DefaultAdminUser = User{
	Name:     DEFAULT_ADMIN_USERNAME,
	Password: calcHash(DEFAULT_ADMIN_PASSWORD),
	Role:     ROLE_ADMIN,
}
View Source
var (
	SQL_TX_FRAME_INSERT = "" /* 145-byte string literal not displayed */
)

Functions

func RxSpotListDays

func RxSpotListDays(limit int, offset int)

Types

type DbObj

type DbObj interface {
	Save(*sql.DB) error
	WebsocketEvent
}

type Js8callEvent

type Js8callEvent struct {
	Type   string             `json:"type"`
	Value  string             `json:"value"`
	Params Js8callEventParams `json:"params"`

	DataType string
	Data     interface{}
}

type Js8callEventParams

type Js8callEventParams struct {
	Id        interface{} `json:"_ID"`
	Dial      uint32      `json:"DIAL"`
	Freq      uint32      `json:"FREQ"`
	Offset    uint16      `json:"OFFSET"`
	Snr       int16       `json:"SNR"`
	Speed     int         `json:"SPEED"`
	TimeDrift float32     `json:"TDRIFT"`
	Grid      string      `json:"GRID"`
	From      string      `json:"FROM"`
	Call      string      `json:"CALL"`
	To        string      `json:"TO"`
	Text      string      `json:"TEXT"`
	Command   string      `json:"CMD"`
	Extra     string      `json:"EXTRA"`
	PTT       bool        `json:"PTT"`
	Tones     []int       `json:"TONES"`
	UTC       int64       `json:"UTC"`
	Selected  string      `json:"SELECTED"`
	Band      string      `json:"BAND"`
	Mode      string      `json:"MODE"`
	Submode   string      `json:"SUBMODE"`
	RptSent   string      `json:"RPT.SENT"`
	RptRecv   string      `json:"RPT.RECV"`
}

type RigPttWsEvent

type RigPttWsEvent struct {
	Enabled bool
}

func CreateRigPttWsEvent

func CreateRigPttWsEvent(event *Js8callEvent) (*RigPttWsEvent, error)

func (*RigPttWsEvent) WsType

func (o *RigPttWsEvent) WsType() string

type RigStatusWsEvent

type RigStatusWsEvent struct {
	Dial     uint32
	Freq     uint32
	Offset   uint16
	Channel  uint16
	Speed    string
	Selected string
}

func CreateRigStatusWsEvent

func CreateRigStatusWsEvent(event *Js8callEvent) (*RigStatusWsEvent, error)

func (*RigStatusWsEvent) WsType

func (o *RigStatusWsEvent) WsType() string

type RxPacketFilter

type RxPacketFilter struct {
	Callsign string
	Freq     RxPacketFilterFreq
}

type RxPacketFilterFreq

type RxPacketFilterFreq struct {
	From uint32
	To   uint32
}

type RxPacketObj

type RxPacketObj struct {
	Id        int64
	Timestamp time.Time
	Type      string
	Dial      uint32
	Channel   uint16
	Freq      uint32
	Offset    uint16
	Snr       int16
	Mode      string
	Speed     string
	TimeDrift int16
	Grid      string
	From      string
	To        string
	Text      string
	Command   string
	Extra     string
}

func CreateRxPacketObj

func CreateRxPacketObj(event *Js8callEvent) (*RxPacketObj, error)

func FetchRxPacketList

func FetchRxPacketList(db *sql.DB, filter *RxPacketFilter, startTime time.Time, direction string) ([]RxPacketObj, error)

func (*RxPacketObj) Insert

func (obj *RxPacketObj) Insert(db *sql.DB) error

func (*RxPacketObj) Save

func (obj *RxPacketObj) Save(db *sql.DB) error

func (*RxPacketObj) Scan

func (obj *RxPacketObj) Scan(rows *sql.Rows) error

func (*RxPacketObj) WsType

func (o *RxPacketObj) WsType() string

type RxSpotObj

type RxSpotObj struct {
	Id        int64
	Timestamp time.Time
	Call      string
	Grid      string
	Snr       int16
	Channel   uint16
	Dial      uint32
	Freq      uint32
	Offset    uint16
}

func CreateRxSpotObj

func CreateRxSpotObj(event *Js8callEvent) (*RxSpotObj, error)

func (*RxSpotObj) Insert

func (obj *RxSpotObj) Insert(db *sql.DB) error

func (*RxSpotObj) Save

func (obj *RxSpotObj) Save(db *sql.DB) error

func (*RxSpotObj) WsType

func (o *RxSpotObj) WsType() string

type StationInfoObj

type StationInfoObj struct {
	Id        int64
	Timestamp string
	Latest    bool
	StationInfoWsEvent
}

func CreateStationInfoObj

func CreateStationInfoObj(stationInfo StationInfoWsEvent) *StationInfoObj

func FetchLatestStationInfo

func FetchLatestStationInfo(db *sql.DB) (StationInfoObj, error)

func (*StationInfoObj) Insert

func (obj *StationInfoObj) Insert(db *sql.DB) error

func (*StationInfoObj) Save

func (obj *StationInfoObj) Save(db *sql.DB) error

func (*StationInfoObj) Scan

func (obj *StationInfoObj) Scan(rows *sql.Row) error

type StationInfoWsEvent

type StationInfoWsEvent struct {
	Call   string
	Grid   string
	Info   string
	Status string
}

func (*StationInfoWsEvent) UpdateFromEvent

func (o *StationInfoWsEvent) UpdateFromEvent(event *Js8callEvent) error

func (*StationInfoWsEvent) WsType

func (o *StationInfoWsEvent) WsType() string

type TxFrameObj

type TxFrameObj struct {
	Id        int64
	Timestamp time.Time
	Channel   uint16
	Dial      uint32
	Freq      uint32
	Offset    uint16
	Mode      string
	Speed     string
	Selected  string
	Tones     []int
}

func CreateTxFrameObj

func CreateTxFrameObj(event *Js8callEvent) (*TxFrameObj, error)

func (*TxFrameObj) ApplyRigStatus

func (obj *TxFrameObj) ApplyRigStatus(rig *RigStatusWsEvent)

func (*TxFrameObj) Insert

func (obj *TxFrameObj) Insert(db *sql.DB) error

func (*TxFrameObj) Save

func (obj *TxFrameObj) Save(db *sql.DB) error

func (*TxFrameObj) WsType

func (o *TxFrameObj) WsType() string

type User

type User struct {
	Id       int64
	Name     string
	Password string
	Role     string
	Bio      string
}

func (*User) CheckPassword

func (obj *User) CheckPassword(password string) bool

func (*User) Insert

func (obj *User) Insert(db *sql.DB) error

func (*User) SetPassword

func (obj *User) SetPassword(password string)

type WebsocketEvent

type WebsocketEvent interface {
	WsType() string
}

type WebsocketMessage

type WebsocketMessage struct {
	EventType string
	WsType    string
	Event     interface{}
}

Jump to

Keyboard shortcuts

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