func finaliserModbusRTUConnection(obj *ModbusRTUConnection) {
	log.Print("Cleaning libmodbus structure")
	C.modbus_close(obj.ctx)
	C.modbus_free(obj.ctx)
	if obj.hook != nil {
		obj.rwCtlChan <- (-1)
	}
}
예제 #2
0
// The modbus_free() function shall free an allocated modbus_t structure.
func (this *RtuConnection) Free() {
	if this.ctx != nil {
		C.modbus_free(this.ctx)
		this.ctx = nil
	} else {
		panic("Double free modbus context!")
	}
}