mihari

package module
v0.0.0-...-528351b Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MIT Imports: 14 Imported by: 0

README

[WIP]MIHARI

Mihari collects wireless quality of cellular from modem

Data format

LTE

{
  "timestamp": 1639997713775,
  "rat": "LTE",
  "state": "NOCONN",
  "is_tdd": "FDD",
  "mcc": 440,
  "mnc": 10,
  "cellid": "2734000",
  "pcid": 400,
  "earfcn": 1850,
  "freq_band_ind": 3,
  "ul_bandwidth": 5,
  "dl_bandwidth": 5,
  "tac": 1684,
  "rsrp": -92,
  "rsrq": -8,
  "rssi": -64,
  "sinr": 15,
  "srxlev": 37
}

WCDMA

{
  "timestamp": 1639997713775,
  "rat": "WCDMA",
  "state": "NOCONN",
  "mcc": 440,
  "mnc": 10,
  "lac": "60",
  "cellid": "6FD8000",
  "uarfcn": 1037,
  "psc": 20,
  "rac": 0,
  "rscp": -64,
  "ecio": -3,
  "phych": 0,
  "sf": 0,
  "slot": 0,
  "speech_code": 0,
  "com_mod": 0
}

Supported modem list

  • Quectel EG25

Output integration

  • SORACOM Harvest

TODO

  • CI/CD
  • Package manager
  • More modem support

Documentation

Index

Constants

View Source
const (
	QuectelModeSearch  = "SEARCH"
	QuectelModeLimsrv  = "LIMSRV"
	QuectelModeNoconn  = "NOCONN"
	QuectelModeConnect = "CONNECT"
)
View Source
const (
	RATTypeGSM     = "GSM"
	RATTypeWCDMA   = "WCDMA"
	RATTypeLTE     = "LTE"
	RATTypeCDMAHDR = "CDMAHDR"
	RATTypeTDSCDMA = "TDSCDMA"
)

Variables

View Source
var (
	ErrModemNotAttached    = errors.New("modem is not attached")
	ErrModemNoModeReponded = errors.New("queccell mode info was not responded")
	ErrModemNoRATResponded = errors.New("queccell rat info was not responded")
)
View Source
var (
	ErrNoIMEI  = errors.New("IMEI was not responded")
	ErrNoIMSI  = errors.New("IMSI was not responded")
	ErrNoICCID = errors.New("ICCID was not responded")
)

Functions

func ListPorts

func ListPorts() []string

Types

type CellInfo

type CellInfo interface {
}

type Client

type Client struct {
	CellInfo
	// contains filtered or unexported fields
}

func NewCientWithConfig

func NewCientWithConfig(config *Config) (*Client, error)

func NewClient

func NewClient(config *Config) (*Client, error)

func (*Client) Check

func (client *Client) Check() error

func (*Client) Close

func (client *Client) Close()

func (*Client) Exec

func (client *Client) Exec()

func (*Client) Run

func (client *Client) Run()

type Config

type Config struct {
	ConfigFilePath string
	Verbose        bool
	Name           string `yaml:"name"`
	Path           string `yaml:"path"`
	Interval       int    `yaml:"interval"`
	NewLineCode    string `yaml:"newline_code"`
	Parity         string `yaml:"parity"`
	Stopbits       int    `yaml:"stopbits"`
	Baurdrate      int    `yaml:"baudrate"`
	Databits       int    `yaml:"databits"`
	ReadTimeout    int    `yaml:"read_timeout"`
	Forwarder      string `yaml:"forwarder"`
}

type Modems map[string]interface{}

func NewConfig

func NewConfig(path string) (*Config, error)

func (*Config) Validate

func (config *Config) Validate() error

TODO: improve validate

type LTECellInfo

type LTECellInfo struct {
	Timestamp   int64  `json:"timestamp"` // epoch milli sec
	RAT         string `json:"rat"`
	State       string `json:"state"`
	IsTDD       string `json:"is_tdd"`
	MCC         int    `json:"mcc,omitempty"`
	MNC         int    `json:"mnc,omitempty"`
	CellID      string `json:"cellid,omitempty"`
	PCID        int    `json:"pcid,omitempty"`
	EARFCN      int    `json:"earfcn,omitempty"`
	Band        int    `json:"freq_band_ind,omitempty"`
	ULBandwidth int    `json:"ul_bandwidth,omitempty"`
	DLBandwidth int    `json:"dl_bandwidth,omitempty"`
	Tac         int    `json:"tac,omitempty"`
	RSRP        int    `json:"rsrp,omitempty"`
	RSRQ        int    `json:"rsrq,omitempty"`
	RSSI        int    `json:"rssi,omitempty"`
	SINR        int    `json:"sinr,omitempty"`
	Srxlev      int    `json:"srxlev,omitempty"`
}

type Modem

type Modem struct {
	serial.Port
	Manufacture      string
	Model            string
	FirmwareRevision string
	IMEI             string
	IMSI             string
	ICCID            string
	RAT              string
}

type WCDMACellInfo

type WCDMACellInfo struct {
	Timestamp  int64  `json:"timestamp"` // epoch milli sec
	RAT        string `json:"rat"`
	State      string `json:"state"`
	MCC        int    `json:"mcc"`
	MNC        int    `json:"mnc"`
	LAC        string `json:"lac"`
	CellID     string `json:"cellid"`
	UARFCN     int    `json:"uarfcn"`
	PSC        int    `json:"psc"`
	RAC        int    `json:"rac"`
	RSCP       int    `json:"rscp"`
	ECIO       int    `json:"ecio"`
	PhyCh      int    `json:"phych"`
	SF         int    `json:"sf"`
	Slot       int    `json:"slot"`
	SpeechCode int    `json:"speech_code"`
	ComMod     int    `json:"com_mod"`
}

TODO: Support 3G

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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