aqir

package module
v0.0.0-...-20a7071 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

aqir - utility for fetching AQI (Air Quality Index) from a certain hardware module

Documentation

Index

Constants

View Source
const (
	RESP_STATUS_CODE_OK               = 0x9000 //请求被正确处理
	RESP_STATUS_CODE_SYS_BUSY         = 0x9001 //系统忙
	RESP_STATUS_CODE_INV_PKG          = 0x9002 //无效的包
	RESP_STATUS_CODE_UNK_CMD          = 0x9003 //未知的包命令字
	RESP_STATUS_CODE_ERR_PKG_LEN      = 0x9004 //错误的包长度
	RESP_STATUS_CODE_INV_SN           = 0x9005 //无效的序号
	RESP_STATUS_CODE_FAIL_VERIFY      = 0x9006 //校验失败
	RESP_STATUS_CODE_FAULT_HW         = 0x9007 //硬件故障
	RESP_STATUS_CODE_IL_OP            = 0x9008 //非法操作
	RESP_STATUS_CODE_DOS              = 0x9045 //未登录设备,拒绝服务
	RESP_STATUS_CODE_INV_ARG_LEN      = 0x9056 //参数长度错误
	RESP_STATUS_CODE_EXCEPT_SEC_STORE = 0x9057 //安全存储异常
)
View Source
const (
	CMD_SET_PINCODE = 0x03
	CMD_CHK_PINCODE = 0x04
	CMD_BURN_KEYS   = 0x05
	CMD_GET_WALLET  = 0x24
	CMD_SIGN_TX     = 0x45
)

Variables

This section is empty.

Functions

func BurnKeypair

func BurnKeypair() (bool, error)

func CalcAQI

func CalcAQI(ug float32) (int16, error)

func CheckPinCode

func CheckPinCode() (bool, error)

func FetchAQI

func FetchAQI() error

func GetWalletPK

func GetWalletPK()

func SetPinCode

func SetPinCode(code string) (bool, error)

func SignTx

func SignTx()

Types

type ReqDatagram

type ReqDatagram struct {
	ReqGramLen int32 //2000 bytes of maximum
	ReqSN      int32
	ReqCmdId   int8
	ReqArgLen  int32
	ReqArg     []byte
}

type RespDatagram

type RespDatagram struct {
	RespGramLen    int32
	RespSN         int32
	RespStatusCode int16
	RespCmdId      int8
	RespArgLen     int32
	RespArg        []byte
}

Jump to

Keyboard shortcuts

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