Documentation ¶
Index ¶
- Variables
- func Bcd2Hex(n byte) byte
- func Bcd2_2f(a, b int) float64
- func ByteToFloat32(bytes []byte) float32
- func ByteToFloat64(bytes []byte) float64
- func BytesToInt(b []byte) int
- func Closeser() error
- func Float32ToByte(float float32) []byte
- func Float64ToByte(float float64) []byte
- func Hex2Bcd(n byte) byte
- func HexStringReverse(str string) string
- func Ifa2uint16(ifa interface{}) (uint16, error)
- func Ifal2bytel(ifal interface{}) ([]byte, error)
- func IntToBytes(n int) []byte
- func Openser(param *simplejson.Json) (err error)
- func Rmser(results []byte) (int, error)
- func Rser() (results []byte, err error)
- func SerialRead(serport serial.Port, timeout time.Duration, results []byte) (rblen int, err error)
- func StringReverse(str string) string
- func Wser(data []byte) error
- type Device
- type Devicerwer
- type Devlist
- type Dict
- type ModbusRtu
- type ModbusTcp
Constants ¶
This section is empty.
Variables ¶
View Source
var Commif = make(map[string]string)
Commif ..
View Source
var Mutex = make(map[string]*sync.Mutex)
Mutex ..
View Source
var RegDevice = make(Devlist)
RegDevice ..
View Source
var RemotePort serial.Port
RemotePort ...
Functions ¶
func Openser ¶
func Openser(param *simplejson.Json) (err error)
Openser ...
{ "cmd": "remoteSerial", "parse": "openser", "data": { "port":"/dev/ttyUSB0", "baudrate": "9600", "databits": "8", "stopbits": "1", "parity": "E" } }
func SerialRead ¶
SerialRead ..
Types ¶
type Device ¶
type Device struct { Dname string DepService bool Devid string Devtype string Commif string Devaddr string Mutex *sync.Mutex }
Device ..
type Devicerwer ¶
type Devicerwer interface { NewDev(id string, ele map[string]string) (Devicerwer, error) RWDevValue(rw string, m Dict) (Dict, error) CheckKey(e Dict) (bool, error) GetElement() (Dict, error) HelpDoc() interface{} GetCommif() string }
Devicerwer ..
type ModbusRtu ¶
type ModbusRtu struct { //组合Device Device `json:"device"` /**************按不同设备自定义*************************/ BaudRate int `json:"baud_rate"` DataBits int `json:"data_bits"` StopBits int `json:"stop_bits"` Parity string `json:"parity"` FunctionCode int `json:"function_code"` StartingAddress uint16 `json:"starting_address"` Quantity uint16 `json:"quantity"` }
ModbusRtu struct
Click to show internal directories.
Click to hide internal directories.