xproto

package module
v0.0.0-...-71fa57a Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 16 Imported by: 0

README

mdvr 协议池

  • ho (私有协议)

  • ttx (私有协议)

  • jt (jt808)

Documentation

Index

Constants

View Source
const (
	Alarm_Unknow                  = 0x00 //未知   //unknow
	Alarm_VideoLost               = 0x01 //视频丢失   //video lost
	Alarm_MotionDetection         = 0x02 //移动侦测   //motion detection
	Alarm_VideoMask               = 0x03 //视频遮挡   //video blind
	Alarm_InputGenerate           = 0x04 //输入触发   //input trigger
	Alarm_Urgency                 = 0x05 //紧急告警   //emmergency alarm
	Alarm_LowSpeed                = 0x06 //低速告警   //low speed alarm
	Alarm_OverSpeed               = 0x07 //超速告警   //overspeed alarm
	Alarm_LowTemperature          = 0x08 //低温告警   //low temperature alarm
	Alarm_OverTemperature         = 0x09 //高温告警   //high temperature alarm
	Alarm_Humidity                = 0x0a //湿度告警   //humidity alarm
	Alarm_ParkTimeout             = 0x0b //超时停车   //park timeout alarm
	Alarm_Shake                   = 0x0c //震动告警   //vibration alarm
	Alarm_Geofence                = 0x0d //电子围栏   //electronic defence
	Alarm_GeoLine                 = 0x0e //电子线路   //electronic line
	Alarm_DoorException           = 0x0f //异常开关门   //door open/ close exception
	Alarm_StorageException        = 0x10 //存储介质异常   //storage exception
	Alarm_FatigueDriving          = 0x11 //疲劳驾驶   //fatigue driving
	Alarm_FuelException           = 0x12 //油量异常   //fuel exception
	Alarm_IllegalFire             = 0x13 //非法点火   //illegal ACC
	Alarm_LocationModuleException = 0x14 //定位模块异常   //location module exception
	Alarm_FrontPanelPrise         = 0x15 //前面板打开   //front panel prise
	Alarm_SwipeCard               = 0x16 //刷卡		//swipe card
	Alarm_SwipeIbutton            = 0x17 //IBUTTON	//ibutton
	Alarm_HarshAcceleration       = 0x18 //急加速
	Alarm_HarshBraking            = 0x19 //急减速
	Alarm_LowSpeedWarn            = 0x1a //低速预警	26
	Alarm_OverSpeedWarn           = 0x1b //高速预警
	Alarm_VoltageWarn             = 0x1c //电压告警
	Alarm_PeopleCounting          = 0x1d //人数统计
	Alarm_DmsOrAdas               = 0x1e //dms和adas报警(主动安全)
	Alarm_AccOn                   = 0x1f //acc on
	Alarm_SpeedIdle               = 0x20 //怠速告警
	Alarm_GpsAntennaOpen          = 0x21 //Gps天线开路
	Alarm_GpsAntennaCircuit       = 0x22 //Gps天线短路
	Alarm_IoOutput                = 0x23 //IO输出
	Alarm_CanbusException         = 0x24 //CANBus连接异常
	Alarm_Ttrailer                = 0x25 //拖车
	Alarm_Glide                   = 0x26 //空挡滑行
	Alarm_RpmHigh                 = 0x27 //转速过高
	Alarm_VehicleMovement         = 0x28 //车辆移动
	Alarm_TripStart               = 0x29 //行程开始
	Alarm_TripDuring              = 0x2A //行程中
	Alarm_TripEnd                 = 0x2B //行程结束
	Alarm_LocateRecovery          = 0x2C //定位恢复
	Alarm_VideoAnomaly            = 0x2D //视频异常
	Alarm_NoneTripPositon         = 0x2E //视频异常
	Alarm_DisconnectServer        = 0x2F //断开连接
)

报警类型

Variables

View Source
var (
	ErrNo            = errors.New("success")         //
	ErrTimeout       = errors.New("timeout")         // 超时
	ErrParam         = errors.New("parameter error") // 参数错误
	ErrNoResult      = errors.New("no result")       // 结果错误
	ErrObjectExist   = errors.New("already exists")  // 链接已存在
	ErrObjectNoExist = errors.New("doesn't exist")   // 链接不存在
	ErrInvalidDevice = errors.New("invalid device")
	ErrUnSupport     = errors.New("unsupport")
	ErrRecvOver      = errors.New("data over")
)
View Source
var DefaultAdapters []AdapterHandler
View Source
var DefaultResult = &Result{
	reqTimeout: 30,
}

Functions

func DownloadFile

func DownloadFile(filename string, v interface{}) (interface{}, error)

func FileSess

func FileSess(r *FileTransfer) string

up-1-filename up-文件类型-文件名 FileSess 文件传输会话号

func LogAlarm

func LogAlarm(b []byte, arg interface{}, a *Alarm)

LogAlarm 报警输出

func LogEvent

func LogEvent(b []byte, arg interface{}, e *Event)

LogEvent 事件输出

func LogFrame

func LogFrame(arg interface{}, f *Frame) error

LogFrame 帧输出

func LogStatus

func LogStatus(tag string, arg interface{}, s *Status)

LogStatus 状态数据输出

func NewUUID

func NewUUID(s *string)

func StopAll

func StopAll()

StopAll 停止所有链接

func SyncSend

func SyncSend(cmd ReqCode, s interface{}, r interface{}, args ...string) error

SyncSend 发送信息到设备

func SyncStop

func SyncStop(args ...string)

SyncStop 停止服务

func SyncWrite

func SyncWrite(s *RawData) error

SyncWrite 发送信息到设备

func UUID

func UUID() string

UUID 生成Guid字串

func UploadFile

func UploadFile(a *Access, filename string, showProgress bool) error

UploadFile 上传文件参考

Types

type Access

type Access struct {
	Tag           string   `json:"-"`
	DeviceNo      string   `json:"deviceNo"`   // 设备号
	DeviceTime    string   `json:"deviceTime"` // 设备时间
	Online        bool     `json:"online"`
	RemoteAddress string   `json:"remoteAddress"` // 设备网络地址
	Session       string   `json:"session"`       // 链路会话号
	LinkType      LinkCode `json:"linkType"`      // 链路类型
	UpTraffic     int64    `json:"upTraffic"`     // 上行流量
	DownTraffic   int64    `json:"downTraffic"`   // 下行流量
	NetType       NetCode  `json:"netType"`       // 网络类型
	Version       string   `json:"version"`       // 版本信息
	DevType       string   `json:"devType"`       // 设备类型
}

Access 链路注册

func AllAccess

func AllAccess() (r []Access)

AllAccess 所有接入信息

type ActCode

type ActCode = int
const (
	Act_Download ActCode = iota // 从设备下载文件
	Act_Upload                  // 上传文件到设备
)

type AdapterHandler

type AdapterHandler func(*Conn) IClient

type Alarm

type Alarm struct {
	Tag       string      `json:"-"`
	DeviceNo  string      `json:"deviceNo"`
	DTU       string      `json:"dtu"`
	UUID      string      `json:"uuid"`
	Type      int         `json:"type"`
	SubType   int         `json:"subType"`
	StartTime string      `json:"startTime"`
	EndTime   string      `json:"endTime"`
	Data      interface{} `json:"data"`
	Status    *Status     `json:"status"`
}

Alarm 报警

type AlrChannel

type AlrChannel struct {
	Channel int `json:"ch"`
}

Channel 和通道相关的报警数据如: io/video...等,具体数据自定义 和通道相关的报警

type AlrShake

type AlrShake struct {
	Type int `json:"dt"` // 1-x 2-y 3-z 4-hit 5-tilt
	AlrThreshold
}

AlrShake

type AlrSpeed

type AlrSpeed struct {
	AlrThreshold
	Dur  uint `json:"dur"`  // 时长
	Spds int  `json:"spds"` // 速度来源
}

type AlrThreshold

type AlrThreshold struct {
	Value int     `json:"vt"` // 触发
	Time  int     `json:"tt"`
	Min   float32 `json:"min"`
	Max   float32 `json:"max"`
	Avg   float32 `json:"avg"`
	Cur   float32 `json:"cur"`
	Pre   float32 `json:"pre"`
}

Threshold 和阈值相关的报警

type CaptureResult

type CaptureResult struct {
	Channel  int    `json:"channel"`
	FileName string `json:"fileName"`
}

type Conn

type Conn struct {
	Srv    *Server
	Result *Result
	UsrArg interface{}
	// 一个conn链接对应一个context, 解析后在map中刷新context
	Context
	// contains filtered or unexported fields
}

Conn tcp Conn

func (*Conn) Body

func (o *Conn) Body() []byte

func (*Conn) Close

func (c *Conn) Close()

Close 关闭socket

func (*Conn) NotifyAccess

func (c *Conn) NotifyAccess(b []byte) (err error)

Access register

func (*Conn) NotifyAlarm

func (c *Conn) NotifyAlarm(b []byte, a *Alarm)

alarm callback

func (*Conn) NotifyDropped

func (c *Conn) NotifyDropped(err error)

Dropped

func (*Conn) NotifyEvent

func (c *Conn) NotifyEvent(b []byte, e *Event)

event callback

func (*Conn) NotifyFile

func (c *Conn) NotifyFile(file *File)

file query callback

func (*Conn) NotifyFrame

func (c *Conn) NotifyFrame(f *Frame) error

av frame callback

func (*Conn) NotifyStatus

func (c *Conn) NotifyStatus(tag string, s *Status)

alarm callback

func (*Conn) WriteBytes

func (c *Conn) WriteBytes(data []byte) error

WriteBytes 直接写入

type Context

type Context struct {
	Access
	Status Status
	// contains filtered or unexported fields
}

func SyncGet

func SyncGet(args ...string) *Context

SyncGet 从映射表中获取链接

type Control

type Control struct {
	Type CtrlCode    `json:"ctrlCode"`
	Data interface{} `json:"data"`
}

type CtrlCode

type CtrlCode = int
const (
	Ctrl_Unknow        CtrlCode = iota
	Ctrl_Reboot                 // nil
	Ctrl_PTZ                    // PTZControl
	Ctrl_Reset                  // nil
	Ctrl_Vehi                   // nil
	Ctrl_GsensorAdjust          // nil
	Ctrl_OsdSpeed               // {"osdSpeed": }
	Ctrl_Snapshot               // CtrlSnapshot
	Ctrl_Format                 // nil
	Ctrl_Text                   // nil
	Ctrl_Property
	Ctrl_Playback
	Ctrl_Live
	Ctrl_MileReset
)

type CtrlLive

type CtrlLive struct {
	Channel          uint8 `json:"channel"`
	Type             uint8 `json:"type"`
	CloseMeidaType   uint8 `json:"closeMeidaType"`
	ToggleStreamType uint8 `json:"toggleStreamType"`
}

type CtrlOsd

type CtrlOsd struct {
	Speed string `json:"osdSpeed"`
}

type CtrlPTZ

type CtrlPTZ struct {
	Code    PTZCode `json:"code"`
	Channel int     `json:"channel"`
	Speed   int     `json:"speed"`
}

type CtrlSnapshot

type CtrlSnapshot struct {
	Channels  string `json:"channels"`  //
	Reslution int    `json:"reslution"` // 0-跟随录像 1-1080p 2-720p 4-D1

}

type CtrlText

type CtrlText struct {
	Type    int    `json:"type"`
	Content string `json:"content"`
}

type CtrlVehi

type CtrlVehi struct {
	Code VehiCode `json:"code"`
	Door int      `json:"door,omitempty"` // Action=5或6有效
}

type Disk

type Disk struct {
	Type    uint8  `json:"tp"` // 类型
	Status  uint8  `json:"st"` // 状态
	Size    uint32 `json:"sz"` // 大小
	Residue uint32 `json:"re"` // 剩余
}

Disk 磁盘

type Driver

type Driver struct {
	ID   string `json:"id"`   // 卡号
	Name string `json:"name"` // 名子
}

type Event

type Event struct {
	Tag      string      `json:"-"`
	DeviceNo string      `json:"deviceNo"`
	Session  string      `json:"session"`
	DTU      string      `json:"dtu"`
	Type     EventCode   `json:"type"`
	Data     interface{} `json:"data"` // 负载数据
	Status   *Status     `json:"status"`
}

Event 事件

type EventCode

type EventCode = int

EventCode 事件类型

const (
	Event_File             EventCode = iota + 0x500 //  未知
	Event_FileTimedCapture                          //  文件
	Event_FileLittle                                //  ftp文件传输
	Event_FileTransfer
	Event_Upgrade
	Event_FtpTransfer = (0x5ff)
)

type EventFile

type EventFile struct {
	FileName string   `josn:"fileName"`
	FileType FileCode `json:"fileType"`
	Capture  struct {
		Channel   int     `json:"channel"`
		Latitude  float32 `json:"latitude"`
		Longitude float32 `json:"longitude"`
		Speed     float32 `json:"speed"`
	} `json:"capture"`
	Little struct {
		Channel  int `json:"channel"`
		Size     int `json:"size"`
		Duration int `json:"duration"`
	}
	Ftp string `json:"ftp"`
}

EventFile

type File

type File struct {
	FileName     string   `json:"fileName"`
	FileType     FileCode `json:"fileType"`
	Channel      int      `json:"channel"`
	StartTime    string   `json:"startTime"`
	EndTime      string   `json:"endTime"`
	FileSize     int      `json:"fileSize"`
	FileDuration int      `json:"fileDuration"`
}

File 查找结果

type FileCode

type FileCode = int
const (
	File_Unknow      FileCode = iota
	File_NormalVideo          // 录像
	File_AlarmVideo           // 报警录像
	File_NormalPic            // 照片
	File_AlarmPic             // 报警照片
	File_Upgrade              // 升级文件
	File_Log                  // 日志文件
	File_Configure            // 配置文件
	File_BlackBox             // 黑匣子文件
	File_NormalVoice          // 正常声音
	File_AlarmVoice           // 报警声音
	File_Evidence             // 报警关联文件
)

type FileTransfer

type FileTransfer struct {
	Session  string  `json:"session"`  // 自动生成session
	FileType int     `json:"fileType"` // 1:录像;2:报警录像;3:照片;4:报警照片;5:升级文件;6:日志文件;7:配置文件;8:黑匣子文件
	FileName string  `json:"fileName"`
	Server   string  `json:"server"`
	Action   ActCode `json:"action"`   //
	FileSize int     `json:"fileSize"` // 文件大小,上传文件到设备时要设置做校验用
	Offset   int     `json:"offset"`
}

FileTransfer 文件传输

func FileOfSess

func FileOfSess(ss string) (r FileTransfer)

type Frame

type Frame struct {
	DeviceNo  string
	Session   string
	Channel   uint16
	Type      uint16
	Timestamp int64
	Data      []byte
	*Status
}

type FrameCode

type FrameCode = uint16
const (
	Frame_Invalid FrameCode = iota //  无效
	Frame_VideoI                   //  视频I帧
	Frame_VideoP                   //  视频P帧
	Frame_Audio                    //  hisi g726音频帧
	Frame_RawData                  //  透传数据,原始数据
	Frame_File                     //  文件数据帧
	Frame_Status                   //  状态数据
)

type FtpTransfer

type FtpTransfer struct {
	Session  string `json:"session"`
	FtpURL   string `json:"ftpUrl"`   // ftp://admin:admin@192.168.1.101:21
	FileType int    `json:"fileType"` // 1:录像;2:报警录像;3:照片;4:报警照片;5:升级文件;6:日志文件;7:配置文件;8:黑匣子文件
	FileSrc  string `json:"fileSrc"`  // 源文件
	// jt1078协议虚拟文件格式 /tmp/jrec/chl_stimestamp_etimestamp_alarm_source_strem_store_net
	FileDst string  `json:"fileDst"` // 目标文件
	Action  ActCode `json:"action"`  //
}

FtpTransfer 文件传输

type Gsensor

type Gsensor struct {
	X    float32 `json:"x"`
	Y    float32 `json:"y"`
	Z    float32 `json:"z"`
	Tilt float32 `json:"tilt"` // 倾斜
	Hit  float32 `json:"hit"`  // 撞击
}

Gsensor gsensor 状态

type Handler

type Handler struct {
	// Access register
	Access func([]byte, *Access) (interface{}, error)
	// Dropped
	Dropped func(interface{}, *Access, error)
	// status callback
	Status func(string, interface{}, *Status)
	// alarm callback
	Alarm func([]byte, interface{}, *Alarm)
	// event callback
	Event func([]byte, interface{}, *Event)
	// bin frame callback
	Frame func(interface{}, *Frame) error
	// File callback
	File func(interface{}, *File)
}

type IClient

type IClient interface {
	// callback handler; if return error not nil, will close connection
	OnHandler([]byte) (int, error)
	// callback idel; for Proactively respond to tasks
	OnIdle(*time.Time, *time.Time) error
	// Request 发送指令
	Request(ReqCode, interface{}, interface{}) error
}

InterProtocol 协议接口

type IClientOptions

type IClientOptions interface {
	GetOptions() interface{}
}

type LinkCode

type LinkCode = int

LinkCode 链路类型

const (
	Link_Unknow             LinkCode = iota //  未知
	Link_Signal                             //  信令
	Link_Interactive                        //  交互链路(文件查询等)
	Link_Query                              //  查询链路
	Link_LiveStream                         //  实时预览
	Link_Playback                           //  回放
	Link_FileTransfer                       //  文件传输
	Link_SerialTransmission                 //  串口透传
	Link_Voice                              //  语音
)

type LiveStream

type LiveStream struct {
	Session    string `json:"session"`
	Channel    int    `json:"channel"`
	StreamType int    `json:"streamType"` // 0-主码流 1-子码流
	On         int    `json:"on"`         // 0-停止 1-开启
	Frames     string `json:"frames"`     // 1;2;3
	Protocol   int    `json:"protocol"`
	Server     string `json:"server"`
}

LiveStream 实时流

type Location

type Location struct {
	Type      uint8   `json:"tp"`  // 定位类型
	Speed     float32 `json:"spd"` // 速度
	Angle     float32 `json:"agl"` // 角度
	Longitude float32 `json:"lng"` // 经度
	Latitude  float32 `json:"lat"` // 纬度
	Altitude  int     `json:"alt"` // 海拔
}

Gps 上报Location

type Mileage

type Mileage struct {
	Total uint32 `json:"tml"` // 总共
	Now   uint32 `json:"nml"` // 当前
}

Mileage 里程

type Mobile

type Mobile struct {
	Signal uint8 `json:"sgl"` // 信号强度
	Type   uint8 `json:"tp"`  // 网络类型
}

Mobile 移动网络状态

type Module

type Module struct {
	Dial      uint8  `json:"dial"` // 移动网络(0:数据不存在,1:数据存在)
	Gps       uint8  `json:"gps"`  // 定位模块(0:数据不存在,1:数据存在)
	Wifi      uint8  `json:"wifi"` // WIFI模块(0:数据不存在,1:数据存在)
	Gsensor   uint8  `json:"gs"`   // GSensor(0:数据不存在,1:数据存在)
	Record    uint16 `json:"rec"`  // 每一位代表一个通道
	VideoLoss uint16 `json:"vlos"`
}

Module 模块状态

type NetCode

type NetCode = int

NetCode 网络类型

const (
	Net_Unknow NetCode = iota //  未知
	Net_Cable                 //  有线
	Net_Wifi                  //  Wifi
	Net_2G                    //  2G
	Net_3G                    //  3G
	Net_4G                    //  4G
	Net_5G                    //  5G
)

type Obd

type Obd struct {
	Rpm           int     `json:"rpm"`   // 转速
	Speed         float32 `json:"spd"`   // 速度
	Acc           int     `json:"acc"`   // acc状态
	JQTemp        int     `json:"jtp"`   // 燃油进气温度
	JQMPos        int     `json:"jms"`   // 节气阀位置
	Voltage       float32 `json:"vol"`   // 电压
	Mileage       float32 `jons:"mile"`  // 里程
	TotalFuel     uint32  `json:"tfuel"` // 当前启动后总油耗
	InstanFuel    float32 `json:"ifuel"` // 瞬时油耗
	Efoa          uint8   `json:"efoa"`  // 剩余油量 %
	Airshed       uint8   `json:"airs"`  // 进气流量
	StressMPa     uint8   `json:"strpa"` // 进气管压力
	CoolantsTemp  uint8   `json:"ctemp"` // 冷却液温度
	AirTemp       uint8   `json:"atemp"` // 进气温度
	MotorLimit    uint8   `json:"molmt"` // 发动机负荷计算值
	Position      uint8   `json:"pos"`   // 节气门绝对位置 %
	Vin           string  `json:"vin"`
	EStatus       uint8   `json:"eStatus"`    // 引擎状态 1:on 0:off
	EOnTime       string  `json:"eOnTime"`    // 引擎开启时间
	EOffTime      string  `json:"eOffTime"`   // 引擎关闭时间
	IdleStatus    uint8   `json:"idleStatus"` // 怠速状态 1:start 0:end
	Ha            uint8   `json:"ha"`
	Hb            uint8   `json:"hb"`
	Hc            uint8   `json:"hc"`
	LowBatteryVol uint8   `json:"lowbat"`
}

Obd obd数据

type Oil

type Oil struct {
	Consumption float32 `json:"cus"`
	Remaining   float32 `json:"res"`
}

Oil 油耗

type Options

type Options struct {
	// server host
	Host string
	// server port
	Port uint16
	// http request timeout
	RequestTimeout time.Duration
	// 接收超时 s
	RecvTimeout float64
}

type PTZCode

type PTZCode = int
const (
	PTZ_Unknow PTZCode = iota
	PTZ_Up
	PTZ_Down
	PTZ_Left
	PTZ_Right
	PTZ_LeftUp
	PTZ_LeftDown
	PTZ_RightUp
	PTZ_RightDown
	PTZ_PreSetGoto
	PTZ_PreSetSet
	PTZ_PreSetClear
	PTZ_IrisOpen
	PTZ_IrisClose
	PTZ_ZoomIn
	PTZ_ZoomOut
	PTZ_FocusNear
	PTZ_FocusFar
	PTZ_AutoScan
	PTZ_BrushOn
	PTZ_BrushOff
	PTZ_CruiseOpen
	PTZ_CruiseClose
	PTZ_LightOn
	PTZ_LightOff
)

type People

type People struct {
	Up   uint32 `json:"up"` // 上车人数
	Down uint32 `json:"dw"` // 下车人数
}

人数统计

type Playback

type Playback struct {
	Session   string `json:"session"`
	FileName  string `json:"fileName"`
	Server    string `json:"server"`
	StartTime string `json:"startTime"`
	EndTime   string `json:"endTime"`
	Channels  string `json:"channels"`
	Frames    string `json:"frames"` // 1;2;3
	Action    int    `json:"action"` // 0-下载式回放,1-流式回放
}

Playback 录像文件回放

type Query

type Query struct {
	Server     string   `json:"server"`
	Session    string   `json:"session"`
	StartTime  string   `json:"startTime"`
	EndTime    string   `json:"endTime"`
	FileType   FileCode `json:"fileType"`
	Channels   string   `json:"channels"`   //
	StreamType int      `json:"streamType"` //
	StoreType  int      `json:"storeType"`  // 1 主录像 2
}

Query 查找

type RawData

type RawData struct {
	DeviceNo  string
	Session   string
	Type      uint16
	Channel   uint16 //
	Timestamp int64  // 时间戳
	Data      []byte
}

type ReqCode

type ReqCode = int

type

const (
	Req_None ReqCode = iota //  空指令
	Req_Query
	Req_Parameters
	Req_LiveStream        //  实时视频
	Req_FtpTransfer       //  Ftp升级
	Req_Control           //  控制
	Req_SerialTransparent //  串口透传设置
	Req_SerialTransfer    //  串口传输数据
	Req_Playback          //  录像文件回放
	Req_FileTransfer      //  文件传输
	Req_Voice
	Req_WriteData //  裸数据(文件、语音...)
	Req_User      //  自定义请求
	Req_Close     //  关闭链接
)

type Response

type Response struct {
	Session string      `json:"ss"`
	Details interface{} `json:"details"`
}

Response 通用请求应答

type Result

type Result struct {
	Vals sync.Map
	// contains filtered or unexported fields
}

func NewResult

func NewResult(timeout time.Duration) *Result

func (*Result) Get

func (o *Result) Get(key interface{}) *rValue

Get 获取

func (*Result) Set

func (o *Result) Set(key string, result interface{}) error

Set 设置

func (*Result) SetError

func (o *Result) SetError(key string, err error) error

SetError 设置错误

func (*Result) WaitVal

func (o *Result) WaitVal(k string, v interface{}) error

WaitVal 等待结果

type SerialData

type SerialData struct {
	Type int    `json:"type"`
	Data string `json:"data"`
}

SerialData 透传数据

type SerialTransparent

type SerialTransparent struct {
	Session  string `json:"session"`
	Port     int    `json:"port"`
	BaudRate int    `json:"baudRate"`
	DatBit   int    `json:"dataBit"`
	CheckBit int    `json:"checkBit"`
	StopBit  int    `json:"stopBit"`
}

SerialTransparent 串口透传设置

type Server

type Server struct {
	Handler Handler
	Result  *Result
	*Options
	// contains filtered or unexported fields
}

Serve 服务

func NewServer

func NewServer(opts *Options) (*Server, error)

NewServe 默认服务

func (*Server) ListenTCPAndServe

func (o *Server) ListenTCPAndServe()

ListenTCPAndServe start server

func (*Server) Release

func (o *Server) Release()

Release 关闭服务

func (*Server) Use

func (o *Server) Use(decode ...AdapterHandler)

type Status

type Status struct {
	DeviceNo  string    `json:"deviceNo"`
	DTU       string    `json:"dtu"`    // DTU
	Flag      uint8     `json:"flag"`   // 0-实时 1-补传 2-报警开始Gps 3-报警结束Gps
	Acc       uint8     `json:"acc"`    // acc
	Location  Location  `json:"loc"`    // 位置信息
	Tempers   []float32 `json:"temps"`  // 温度
	Humiditys []float32 `json:"humis"`  // 湿度
	Mileage   Mileage   `json:"mile"`   // 里程
	Oils      []Oil     `json:"oils"`   // 油耗
	Module    Module    `json:"mod"`    // 模块状态
	Gsensor   Gsensor   `json:"gs"`     // GSensor
	Mobile    Mobile    `json:"mobile"` // 移动网络
	Disks     []Disk    `json:"disks"`  // 磁盘
	People    People    `json:"peop"`   // 人数统计
	Obds      []Obd     `json:"obds"`   // obd
	Vol       []float32 `json:"vol"`
	Driver    Driver    `json:"driver"`
}

Status 状态数据

type User

type User struct {
	CodeID string                 `json:"codeId"`
	Data   map[string]interface{} `json:"data"`
}

type VehiCode

type VehiCode = int
const (
	Vehi_CutOil      VehiCode = iota // 切断油路
	Vehi_RecoveryOil                 // 恢复油路
	Vehi_CutCircuit                  // 切断电路
	Vehi_RecCircuit                  // 恢复电路
	Vehi_OpenDoor
	Vehi_CloseDoor
)

type Voice

type Voice struct {
	Session  string `json:"session"`
	WorkMode int    `json:"workMode"` // 0-监听 1-对讲 2-广播
	Channel  int    `json:"channel"`  // 通道
	On       int    `json:"on"`       // 0-停止 1-开启
	Server   string `json:"server"`
}

Voice 语音业务

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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