Documentation
¶
Index ¶
- Constants
- type Bin
- type BinDeactivateRequest
- type BinInfo
- type BinInfoRequest
- type BinOperateResult
- type BusinessRequest
- type BusinessResponse
- type BusinuessUsableRequest
- type Cabinet
- type CabinetBinUsableResponse
- type CabinetNameResponse
- type CabinetStatus
- type DetectBattery
- type DetectBin
- type DetectDoor
- type ExchangeRequest
- type ExchangeResponse
- type ExchangeStep
- type ExchangeStepMessage
- type ExchangeUsableRequest
- type Operate
- type OperateBinRequest
Constants ¶
View Source
const ( UrlMaintainClients = "/maintain/clients" UrlOperateBin = "/operate/bin" UrlBinDeactivate = "/bin/deactivate" UrlBusinessUsable = "/business/usable" UrlBusinessDo = "/business/do" UrlExchangeUsable = "/exchange/usable" UrlExchangeDo = "/exchange/do" UrlDeviceBinInfo = "/device/bininfo" UrlBattery = "/battery" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bin ¶
type Bin struct {
ID uint64 `json:"id,omitempty"`
// 品牌
Brand adapter.CabinetBrand `json:"brand,omitempty"`
// 电柜设备序列号
Serial string `json:"serial,omitempty"`
// 仓位名称(N号仓)
Name string `json:"name,omitempty"`
// 仓位序号(从1开始)
Ordinal int `json:"ordinal,omitempty"`
// 仓门是否开启
Open bool `json:"open,omitempty"`
// 仓位是否启用
Enable bool `json:"enable,omitempty"`
// 仓位是否健康
Health bool `json:"health,omitempty"`
// 是否有电池
BatteryExists bool `json:"battery_exists,omitempty"`
// 电池序列号
BatterySn string `json:"battery_sn,omitempty"`
// 当前电压
Voltage float64 `json:"voltage,omitempty"`
// 当前电流
Current float64 `json:"current,omitempty"`
// 电池电量
Soc float64 `json:"soc,omitempty"`
// 电池健康程度
Soh float64 `json:"soh,omitempty"`
// 仓位备注
Remark *string `json:"remark,omitempty,omitempty"`
}
Bin is the model entity for the Bin schema.
type BinDeactivateRequest ¶
type BinInfo ¶
type BinInfo struct {
Ordinal int `json:"ordinal,omitempty"` // 仓位序号
BatterySN string `json:"batterySn,omitempty"` // 电池编码
Voltage float64 `json:"voltage,omitempty"` // 电压
Current float64 `json:"current,omitempty"` // 电流
Soc float64 `json:"soc,omitempty"` // 电量
Soh float64 `json:"soh,omitempty"` // 健康
Health bool `json:"health,omitempty"` // 健康
Enable bool `json:"enable,omitempty"` // 启用
Open bool `json:"open,omitempty"` // 开启
BatteryExists bool `json:"batteryExists,omitempty"` // 电池在位
}
type BinInfoRequest ¶
type BinOperateResult ¶
type BinOperateResult struct {
UUID string `json:"uuid"`
Step int `json:"step"` // 操作步骤
Business adapter.Business `json:"business"` // 业务类型
StartAt *time.Time `json:"startAt"` // 开始时间
StopAt *time.Time `json:"stopAt"` // 结束时间
Success bool `json:"success"` // 是否成功
Before *BinInfo `json:"before"` // 操作前仓位信息
After *BinInfo `json:"after"` // 操作后仓位信息
Duration float64 `json:"duration,omitempty"` // 耗时
Message string `json:"message,omitempty"` // 消息
}
type BusinessRequest ¶
type BusinessRequest struct {
UUID uuid.UUID `json:"uuid" validate:"required"`
Business adapter.Business `json:"business" validate:"required"` // 业务类别
Serial string `json:"serial" validate:"required"` // 电柜编号
Timeout int64 `json:"timeout" validate:"required"` // 超时时间(s)
Battery string `json:"battery,omitempty"` // 需要校验的电池编号 (可为空, 如果是智能柜需要校验放入电池编号的时候必须携带, 例如putin操作)
Model string `json:"model" validate:"required"` // 电池型号
}
func (*BusinessRequest) String ¶
func (req *BusinessRequest) String() string
type BusinessResponse ¶
type BusinessResponse struct {
Error string `json:"error,omitempty"`
Results []*BinOperateResult `json:"results"`
}
type BusinuessUsableRequest ¶
type BusinuessUsableRequest struct {
Minsoc float64 `json:"minsoc" validate:"required"` // 最小电量
Business adapter.Business `json:"business" validate:"required"`
Serial string `json:"serial" validate:"required"`
Model string `json:"model" validate:"required"` // 电池型号
}
BusinuessUsableRequest 获取业务仓位请求
type Cabinet ¶
type Cabinet struct {
ID uint64 `json:"id,omitempty"`
// 是否在线
Online bool `json:"online,omitempty"`
// 品牌
Brand adapter.CabinetBrand `json:"brand,omitempty"`
// 电柜编号
Serial string `json:"serial,omitempty"`
// 状态
Status CabinetStatus `json:"status,omitempty"`
// 电柜是否启用
Enable bool `json:"enable,omitempty"`
// 经度
Lng *float64 `json:"lng,omitempty,omitempty"`
// 纬度
Lat *float64 `json:"lat,omitempty,omitempty"`
// GSM信号强度
Gsm *float64 `json:"gsm,omitempty,omitempty"`
// 换电柜总电压 (V)
Voltage *float64 `json:"voltage,omitempty,omitempty"`
// 换电柜总电流 (A)
Current *float64 `json:"current,omitempty,omitempty"`
// 柜体温度值 (换电柜温度)
Temperature *float64 `json:"temperature,omitempty,omitempty"`
// 总用电量
Electricity *float64 `json:"electricity,omitempty,omitempty"`
}
Cabinet is the model entity for the Cabinet schema.
type CabinetNameResponse ¶
type CabinetNameResponse struct {
Name string `json:"name"`
}
type CabinetStatus ¶
type CabinetStatus string
const ( StatusInitializing CabinetStatus = "initializing" StatusIdle CabinetStatus = "idle" StatusBusy CabinetStatus = "busy" StatusExchange CabinetStatus = "exchange" StatusAbnormal CabinetStatus = "abnormal" )
CabinetStatus values.
type DetectBattery ¶
type DetectBattery uint8
DetectBattery 电池检测
const ( DetectBatteryIgnore DetectBattery = iota // 忽略 DetectBatteryPutin // 检测是否放入 DetectBatteryPutout // 检测是否取走 )
func (DetectBattery) Text ¶
func (o DetectBattery) Text() string
type DetectDoor ¶
type DetectDoor uint8
DetectDoor 仓门检测
const ( DetectDoorIgnore DetectDoor = iota // 忽略 DetectDoorOpen // 检测是否开门 DetectDoorClose // 检测是否关门 )
func (DetectDoor) Text ¶
func (o DetectDoor) Text() string
type ExchangeRequest ¶
type ExchangeRequest struct {
UUID uuid.UUID `json:"uuid" validate:"required"`
Serial string `json:"serial" validate:"required"` // 电柜编码
Battery string `json:"battery"` // 当前电池编号, 若放入电池型号不匹配, 则中断换电流程
Expires int64 `json:"expires" validate:"required"` // 扫码有效期(s), 例如: 30s
Timeout int64 `json:"timeout" validate:"required"` // 换电步骤超时(s), 例如: 120s
Minsoc float64 `json:"minsoc" validate:"required"` // 换电最小电量
}
type ExchangeResponse ¶
type ExchangeResponse struct {
Success bool `json:"success"` // 是否换电成功
PutoutBattery string `json:"putoutBattery,omitempty"` // 取走电池编号
PutinBattery string `json:"putinBattery"` // 放入电池编号
Results []*ExchangeStepMessage `json:"results,omitempty"` // 步骤详情
Error string `json:"error,omitempty"` // 错误消息
}
type ExchangeStep ¶
type ExchangeStep uint8
ExchangeStep 换电步骤
const ( ExchangeStepOpenEmpty ExchangeStep = iota + 1 // 第一步, 开启空电仓 ExchangeStepPutInto // 第二步, 放入旧电池并关闭仓门 ExchangeStepOpenFull // 第三步, 开启满电仓 ExchangeStepPutOut // 第四步, 取出新电池并关闭仓门 )
func (ExchangeStep) Description ¶
func (es ExchangeStep) Description() string
func (ExchangeStep) EqualInt ¶
func (es ExchangeStep) EqualInt(n int) bool
func (ExchangeStep) Int ¶
func (es ExchangeStep) Int() int
func (ExchangeStep) Is ¶
func (es ExchangeStep) Is(step ExchangeStep) bool
func (ExchangeStep) Uint32 ¶
func (es ExchangeStep) Uint32() uint32
type ExchangeStepMessage ¶
type ExchangeStepMessage BinOperateResult
func (*ExchangeStepMessage) MarshalBinary ¶
func (m *ExchangeStepMessage) MarshalBinary() ([]byte, error)
func (*ExchangeStepMessage) UnmarshalBinary ¶
func (m *ExchangeStepMessage) UnmarshalBinary(data []byte) error
type ExchangeUsableRequest ¶
Click to show internal directories.
Click to hide internal directories.