bvfile

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

README

bvfile

bvfile parse

cmd/bvfile

$ bvfile -f 2622930045_202006091730.bv
CustomerSeriNum: 2622930045
ManufacSerial: 2622930045
LoggerStartDate: 1590796856 2020-05-30 08:00:56
LoggerStopDate: 1591723856 2020-06-10 01:30:56
StartupDelay: 116268
TemperatureUnits: C
AVR: 5.2
MKT: 5.5
HighBinTempTripPoint_B_Temp & Humi: 25 32
HighBinTempTripPoint_A_Temp & Humi: 8 96
LowBinTempTripPoint_A_Temp & Humi: 2 96
LowBinTempTripPoint_B_Temp & Humi: 0 32
LogerName: T301
TimeBase: GMT +08
ConfigBy: biovoice
NumberOfPoints: 3091
MinT: {"at":1591652156,"t":3.9}
MaxT: {"at":1591723556,"t":23.8}

Documentation

Index

Constants

View Source
const (
	BitsUint8  = 8
	BitsUint16 = 16
	BitsUint32 = 32
	BitsUint64 = 64
	BitsUintX  = 100 // string
)
View Source
const (
	LevelEmergency = iota
	LevelAlert
	LevelCritical
	LevelError
	LevelWarning
	LevelNotice
	LevelInformational
	LevelDebug
)
View Source
const Version string = "V1.0.0"

Variables

View Source
var BvFileIndexTable = []BvFileIndex{
	{Name: "CustomerSeriNum", Size: 8, Index: 0, Bits: BitsUint32},
	{Name: "ManufacSerial", Size: 8, Index: 8, Bits: BitsUint32},
	{Name: "CustomerResets", Size: 4, Index: 16, Bits: BitsUint16},
	{Name: "ConfigTime", Size: 8, Index: 20, Bits: BitsUint32},
	{Name: "LoggerStartDate", Size: 8, Index: 28, Bits: BitsUint32},
	{Name: "LoggerStopDate", Size: 8, Index: 36, Bits: BitsUint32},
	{Name: "StartupDelay", Size: 8, Index: 44, Bits: BitsUint32},
	{Name: "MeasurInterval", Size: 8, Index: 52, Bits: BitsUint32},
	{Name: "TemperatureUnits", Size: 1, Index: 60, Bits: BitsUint8},
	{Name: "HighBinTempTripPoint_A", Size: 4, Index: 61, Bits: BitsUint16},
	{Name: "HighBinFuncCounter_A", Size: 8, Index: 65, Bits: BitsUint32},
	{Name: "HighFuncLimit_A", Size: 8, Index: 73, Bits: BitsUint32},
	{Name: "HighBinTempTripPoint_B", Size: 4, Index: 81, Bits: BitsUint16},
	{Name: "HighBinFuncCounter_B", Size: 8, Index: 85, Bits: BitsUint32},
	{Name: "HighFuncLimit_B", Size: 8, Index: 93, Bits: BitsUint32},
	{Name: "LowBinTempTripPoint_A", Size: 4, Index: 101, Bits: BitsUint16},
	{Name: "LowBinFuncCounter_A", Size: 8, Index: 105, Bits: BitsUint32},
	{Name: "LowFuncLimit_A", Size: 8, Index: 113, Bits: BitsUint32},
	{Name: "LowBinTempTripPoint_B", Size: 4, Index: 121, Bits: BitsUint16},
	{Name: "LowBinFuncCounter_B", Size: 8, Index: 125, Bits: BitsUint32},
	{Name: "LowFuncLimit_B", Size: 8, Index: 133, Bits: BitsUint32},
	{Name: "AVR", Size: 4, Index: 141, Bits: BitsUint16},
	{Name: "MKT", Size: 4, Index: 145, Bits: BitsUint16},
	{Name: "TotalTime_HighB", Size: 8, Index: 149, Bits: BitsUint32},
	{Name: "TotalTime_HighA", Size: 8, Index: 157, Bits: BitsUint32},
	{Name: "TotalTime_2_8", Size: 8, Index: 165, Bits: BitsUint32},
	{Name: "TotalTime_LowA", Size: 8, Index: 173, Bits: BitsUint32},
	{Name: "TotalTime_LowB", Size: 8, Index: 181, Bits: BitsUint32},
	{Name: "NoOfViola_HighB", Size: 8, Index: 189, Bits: BitsUint32},
	{Name: "NoOfViola_HighA", Size: 8, Index: 197, Bits: BitsUint32},
	{Name: "NoOfViola_LowA", Size: 8, Index: 205, Bits: BitsUint32},
	{Name: "NoOfViola_LowB", Size: 8, Index: 213, Bits: BitsUint32},
	{Name: "LongestTime_HighB", Size: 8, Index: 221, Bits: BitsUint32},
	{Name: "LongestTime_HighA", Size: 8, Index: 229, Bits: BitsUint32},
	{Name: "LongestTime_LowA", Size: 8, Index: 237, Bits: BitsUint32},
	{Name: "LongestTime_LowB", Size: 8, Index: 245, Bits: BitsUint32},
	{Name: "LogerName", Size: 22, Index: 253, Bits: BitsUintX},
	{Name: "TimeBase", Size: 10, Index: 275, Bits: BitsUintX},
	{Name: "ConfigBy", Size: 20, Index: 285, Bits: BitsUintX},
	{Name: "Notes", Size: 96, Index: 305, Bits: BitsUintX},
	{Name: "NumberOfPoints", Size: 8, Index: 401, Bits: BitsUint32},

	{Name: "Temperature_0", Size: 4, Index: 409, Bits: BitsUint16},
}

BvFileIndexTable bv文件变量位置表

Functions

func Debug

func Debug(enable bool)

Debug Enable debug

func DecodeToString

func DecodeToString(b []byte, bits int) string

DecodeToString 解码为字符串

func DecodeToUInt

func DecodeToUInt(b []byte, bits int) (uint64, error)

DecodeToUInt 解码bin为 uint8/uint16/uint32

func SetUserDebug

func SetUserDebug(f TraceFunc)

SetUserDebug 配置其他日志输出

func TraceError

func TraceError(format string, v ...interface{})

TraceError 错误日志

func TraceInfo

func TraceInfo(format string, v ...interface{})

TraceInfo 调试信息日志

Types

type BvFileIndex

type BvFileIndex struct {
	Name  string
	Size  int
	Index int
	Bits  int
}

bv bin data format

func GetBvFileIndexByName

func GetBvFileIndexByName(name string) *BvFileIndex

type BvFileInfo

type BvFileInfo struct {
	CustomerSeriNum             string  // u32 顾客系列号
	ManufacSerial               string  // u32 厂家系列号
	CustomerResets              int64   // u16 顾客复位次数
	ConfigTime                  int64   // u32 配置时间
	LoggerStartDate             int64   // u32 启动时间
	LoggerStopDate              int64   // u32 停止时间
	StartupDelay                int64   // u32 启动延时时间
	MeasurInterval              int64   // u32 测量间隔
	TemperatureUnits            string  // u8 温度单位
	HighBinTempTripPoint_A      int64   // u16 上限配置值 ?
	HighBinTempTripPoint_A_Temp float32 // 上限配置值 - 温度
	HighBinTempTripPoint_A_Humi float32 // 上限配置值 - 湿度
	HighBinFuncCounter_A        int64   // u32 超上限秒数
	HighFuncLimit_A             string  // u32 上限值 ?
	HighBinTempTripPoint_B      int64   // u16 上上限配置值 ?
	HighBinTempTripPoint_B_Temp float32 // 上上限配置值 - 温度
	HighBinTempTripPoint_B_Humi float32 // 上上限配置值 - 湿度
	HighBinFuncCounter_B        int64   // u32 超上上限秒数
	HighFuncLimit_B             string  // u32 上上限值 ?
	LowBinTempTripPoint_A       int64   // u16 下限配置值 ?
	LowBinTempTripPoint_A_Temp  float32 // 下限配置值 - 温度
	LowBinTempTripPoint_A_Humi  float32 // 下限配置值 - 湿度
	LowBinFuncCounter_A         int64   // u32 超下限秒数
	LowFuncLimit_A              string  // u32 下限值 ?
	LowBinTempTripPoint_B       int64   // u16 下下限配置值 ?
	LowBinTempTripPoint_B_Temp  float32 // 下限配置值 - 温度
	LowBinTempTripPoint_B_Humi  float32 // 下限配置值 - 湿度
	LowBinFuncCounter_B         int64   // u32 超下下限秒数
	LowFuncLimit_B              string  // u32 下下限值 ?
	AVR                         float32 // u16 平均温度
	MKT                         float32 // u16  MKT 值
	TotalTime_HighB             int64   // u32 超上上限总的秒数
	TotalTime_HighA             int64   // u32 超上限总的秒数
	TotalTime_2_8               int64   // u32 未超上限和下限的秒数
	TotalTime_LowA              int64   // u32 超下限总的秒数
	TotalTime_LowB              int64   // u32 超下下限总的秒数
	NoOfViola_HighB             int64   // u32 超上上限总的点数
	NoOfViola_HighA             int64   // u32 超上限总的点数
	NoOfViola_LowA              int64   // u32 超下限总的点数
	NoOfViola_LowB              int64   // u32 超下下限总的点数
	LongestTime_HighB           int64   // u32 超上上限最长一次秒数
	LongestTime_HighA           int64   // u32 超上限最长一次秒数
	LongestTime_LowA            int64   // u32 超下限最长一次秒数
	LongestTime_LowB            int64   // u32 超下下限紧长一次秒数
	LogerName                   string  // u8 记录仪名称字符串
	TimeBase                    string  // u8 基于格林威治时间的各国时间描述符
	ConfigBy                    string  // u8 配置者描述符
	Notes                       string  // u8 留言/笔记字符串
	NumberOfPoints              int64   // u32 数据点数
	PDFPassword                 string  // u8 PDF文件的打开密码 ?

	Temperature_0 int64 // u16/u32  4字节时为温度或者 8字节时为温湿度

	Data []*SensorData // 传感器数据点
}

BvFileInfo bv文件头信息

func (*BvFileInfo) Parse

func (bv *BvFileInfo) Parse(b []byte) error

Parse bv文件解析

func (BvFileInfo) String

func (bv BvFileInfo) String() string

String 序列化成字符串

type SensorData

type SensorData struct {
	At *int64   `json:"at,omitempty"`
	T  *float32 `json:"t,omitempty"`
	H  *float32 `json:"h,omitempty"`
}

SensorData 传感器数据点

func (*SensorData) GetAt

func (d *SensorData) GetAt() int64

GetAt 获取传感器采集时间点

func (*SensorData) GetH

func (d *SensorData) GetH() float32

GetH 获取传感器湿度值

func (*SensorData) GetT

func (d *SensorData) GetT() float32

GetT 获取传感器温度值

func (*SensorData) SetH

func (d *SensorData) SetH(h float32) error

SetH 设置传感器湿度值

func (*SensorData) SetT

func (d *SensorData) SetT(t float32) error

SetT 设置传感器温度值

func (SensorData) String

func (d SensorData) String() string

String 序列化成字符串

type SensorDataList

type SensorDataList []*SensorData

SensorDataList 传感器数据点

func (SensorDataList) Len

func (a SensorDataList) Len() int

func (SensorDataList) Less

func (a SensorDataList) Less(i, j int) bool

func (SensorDataList) Swap

func (a SensorDataList) Swap(i, j int)

type TraceFunc

type TraceFunc func(format string, level int, v ...interface{})
var UserTrace TraceFunc = nil

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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