拆分protobuf

This commit is contained in:
三丙
2025-09-12 14:40:18 +08:00
parent bc5411eb4b
commit 38548b5230
87 changed files with 558 additions and 467 deletions

View File

@@ -0,0 +1,348 @@
/**
* 开源代码,仅供学习和交流研究使用,商用请联系三丙
* 微信mohan_88888
* 抖音:程序员三丙
* 付费课程知识星球https://t.zsxq.com/aKtXo
*/
syntax = "proto3";
package infrastructureProto;
option java_package = "sanbing.jcpp.proto.gen";
option java_outer_classname = "UplinkProto";
// 上行队列消息(从充电桩到服务器)
message UplinkQueueMessage {
int64 messageIdMSB = 1;
int64 messageIdLSB = 2;
int64 sessionIdMSB = 3;
int64 sessionIdLSB = 4;
string messageKey = 5;
string protocolName = 6;
int64 ts = 7;
bytes requestData = 10;
SessionCloseEventProto sessionCloseEventProto = 20;
LoginRequest loginRequest = 21;
HeartBeatRequest heartBeatRequest = 22;
VerifyPricingRequest verifyPricingRequest = 23;
QueryPricingRequest queryPricingRequest = 24;
GunRunStatusProto gunRunStatusProto = 25;
ChargingProgressProto chargingProgressProto = 26;
SetPricingResponse setPricingResponse = 27;
RemoteStartChargingResponse remoteStartChargingResponse = 28;
RemoteStopChargingResponse remoteStopChargingResponse = 29;
TransactionRecordRequest transactionRecordRequest = 30;
BmsChargingErrorProto bmsChargingErrorProto = 31;
BmsParamConfigReportProto bmsParamConfigReportProto = 33;
BmsChargingInfoProto bmsChargingInfoProto = 34;
BmsAbortProto bmsAbortProto = 35;
RestartPileResponse restartPileResponse = 36;
BmsHandshakeProto bmsHandshakeProto = 37;
OtaResponse otaResponse = 38;
GroundLockStatusProto groundLockStatusProto = 39;
OfflineCardBalanceUpdateResponse offlineCardBalanceUpdateResponse = 40;
OfflineCardSyncResponse offlineCardSyncResponse = 41;
TimeSyncResponse timeSyncResponse = 42;
BmsDemandChargerOutputProto bmsDemandChargerOutputProto = 43;
StartChargeRequest startChargeRequest = 44;
}
// 会话关闭事件
message SessionCloseEventProto {
string pileCode = 2; // 充电桩编码
SessionCloseReason reason = 3; // 会话关闭原因
optional string additionalInfo = 20; // 附加信息
}
// 会话关闭原因枚举
enum SessionCloseReason {
SESSION_CLOSE_UNKNOWN = 0; // 未知原因
SESSION_CLOSE_DESTRUCTION = 1; // 自然销毁(空闲超时)
SESSION_CLOSE_ON_CHANNEL_INACTIVE = 2; // 通道不活跃
SESSION_CLOSE_MANUALLY = 3; // 手动关闭
}
// 登录请求
message LoginRequest {
string pileCode = 2;
string credential = 3;
string remoteAddress = 4;
string nodeId = 10;
string nodeHostAddress = 11;
int32 nodeRestPort = 12;
int32 nodeGrpcPort = 13;
optional string additionalInfo = 20;
}
// 启动充电请求
message StartChargeRequest {
int64 ts = 1;
string pileCode = 2; // 桩编号
string gunCode = 3; // 枪编号
string startType = 4; // 启动类型
string cardNo = 5; // 账号或物理卡号
bool needPassword = 6; // 是否需要密码
string password = 7; // 密码
string carVinCode = 8; // 车辆识别码(VIN)
optional string additionalInfo = 20; // 附加信息
}
// 心跳请求
message HeartBeatRequest {
string pileCode = 3;
string remoteAddress = 4;
string nodeId = 10;
string nodeHostAddress = 11;
int32 nodeRestPort = 12;
int32 nodeGrpcPort = 13;
optional string additionalInfo = 20;
}
// 校验计费请求
message VerifyPricingRequest {
string pileCode = 4;
int64 pricingId = 30;
optional string pricingModel = 31;
optional string additionalInfo = 20;
}
// 查询计费请求
message QueryPricingRequest {
string pileCode = 4;
optional string additionalInfo = 20;
}
// 枪运行状态枚举
enum GunRunStatus {
IDLE = 0; // 空闲
INSERTED = 1; // 已插枪
CHARGING = 2; // 充电中
CHARGE_COMPLETE = 3; // 充电完成
DISCHARGE_READY = 4; // 放电准备
DISCHARGING = 5; // 放电中
DISCHARGE_COMPLETE = 6; // 放电完成
RESERVED = 7; // 预约
FAULT = 8; // 故障
UNKNOWN = 9; // 未知
}
// 枪运行状态消息
message GunRunStatusProto {
string pileCode = 4;
string gunCode = 5;
GunRunStatus GunRunStatus = 41;
repeated string faultMessages = 6;
optional string additionalInfo = 20;
}
// 充电进度消息
message ChargingProgressProto {
string pileCode = 4;
string gunCode = 5;
string tradeNo = 6;
string outputVoltage = 7;
string outputCurrent = 8;
int32 soc = 9;
int32 totalChargingDurationMin = 10;
string totalChargingEnergyKWh = 11;
string totalChargingCostYuan = 12;
optional string additionalInfo = 20;
}
// 设置计费响应
message SetPricingResponse {
bool success = 1;
string pileCode = 4;
int64 pricingId = 30;
}
// 远程启动充电响应
message RemoteStartChargingResponse {
string pileCode = 4;
string gunCode = 5;
string tradeNo = 6;
bool success = 7;
string failReason = 8;
optional string additionalInfo = 20;
}
// 重启充电桩响应
message RestartPileResponse {
string pileCode = 4;
bool success = 7;
}
// 远程停止充电响应
message RemoteStopChargingResponse {
string pileCode = 4;
string gunCode = 5;
bool success = 7;
string failReason = 8;
optional string additionalInfo = 20;
}
// 明细类型枚举
enum DetailType {
PEAK_VALLEY = 0; // 峰谷电量明细
TIME_PERIOD = 1; // 时段电量明细
}
// 峰谷电量明细
message PeakValleyDetail {
string topEnergyKWh = 1; // 尖峰电量
string topAmountYuan = 2; // 尖峰电费
string peakEnergyKWh = 3; // 峰时电量
string peakAmountYuan = 4; // 峰时电费
string flatEnergyKWh = 5; // 平时电量
string flatAmountYuan = 6; // 平时电费
string valleyEnergyKWh = 7; // 谷时电量
string valleyAmountYuan = 8; // 谷时电费
string deepEnergyKWh = 9; // 深谷电量
string deepAmountYuan = 10; // 深谷电费
}
// 时段电量明细
message TimePeriodDetail {
message PeriodItem {
int32 periodNo = 1; // 时段序号从1开始
string startTime = 2; // 开始时间,格式 HH:mm:ss
string endTime = 3; // 结束时间,格式 HH:mm:ss
string energyKWh = 4; // 该时段电量
optional string amountYuan = 5; // 该时段电费,可选
}
repeated PeriodItem periods = 1; // 时段列表
}
// 交易明细
message TransactionDetail {
DetailType type = 1; // 明细类型
optional PeakValleyDetail peakValley = 2; // 峰谷电量明细
optional TimePeriodDetail timePeriod = 3; // 时段电量明细
}
// 交易记录请求
message TransactionRecordRequest {
string pileCode = 4; // 充电桩编码
string gunCode = 5; // 枪编号
string tradeNo = 6; // 交易流水号
int64 startTs = 51; // 开始时间戳
int64 endTs = 52; // 结束时间戳
string totalEnergyKWh = 53; // 总电量(必填)
optional string totalAmountYuan = 54; // 总电费(可选)
int64 tradeTs = 55; // 交易时间戳
string stopReason = 56; // 停止原因
int64 pricingId = 57; // 计费ID
optional TransactionDetail detail = 58; // 电量电费明细
optional string additionalInfo = 20; // 附加信息
}
// BMS充电错误消息
message BmsChargingErrorProto {
string pileCode = 4;
string gunCode = 5;
string tradeNo = 6;
optional string additionalInfo = 20;
}
// BMS参数配置上报
message BmsParamConfigReportProto {
string pileCode = 2; // 桩编码
string gunCode = 3; // 枪编码
string tradeNo = 4; // 交易号
string maxSingleCellVoltage = 5; // BMS单体最高允许充电电压 (V)
string maxChargeCurrent = 6; // BMS最高允许充电电流 (A)
string ratedEnergy = 7; // BMS动力蓄电池标称总能量 (kWh)
string maxTotalChargeVoltage = 8; // BMS最高允许充电总电压 (V)
string maxTemperature = 9; // BMS最高允许温度 (℃)
string soc = 10; // BMS荷电状态SOC (%)
string currentBatteryVoltage = 11; // BMS当前电池电压 (V)
string pileMaxOutputVoltage = 12; // 电桩最高输出电压 (V)
string pileMinOutputVoltage = 13; // 电桩最低输出电压 (V)
string pileMaxOutputCurrent = 14; // 电桩最大输出电流 (A)
string pileMinOutputCurrent = 15; // 电桩最小输出电流 (A)
}
// BMS充电信息
message BmsChargingInfoProto {
string pileCode = 4;
string gunCode = 5;
string tradeNo = 6;
optional string additionalInfo = 20;
}
// BMS中止充电
message BmsAbortProto {
string pileCode = 4;
string gunCode = 5;
string tradeNo = 6;
optional string additionalInfo = 20;
}
// BMS握手信息
message BmsHandshakeProto {
string pileCode = 2; // 桩编码
string gunCode = 3; // 枪编码
string tradeNo = 4; // 交易流水号
string bmsProtocolVersion = 5; // BMS通信协议版本号
int32 bmsBatteryType = 6; // BMS电池类型
int32 bmsPowerCapacity = 7; // BMS整车动力蓄电池系统额定容量
int32 bmsPowerMaxVoltage = 8; // BMS整车动力蓄电池系统额定总电压
string bmsFactory = 9; // BMS电池生产厂商名称
int32 bmsSerialNo = 10; // BMS电池组序号
int32 bmsCreateYear = 11; // BMS电池组生产日期年
int32 bmsCreateMonth = 12; // BMS电池组生产日期月
int32 bmsCreateDay = 13; // BMS电池组生产日期日
int32 bmsChargeCount = 14; // BMS电池组充电次数
int32 bmsPropertyRightLabel = 15; // BMS电池组产权标识
string carVinCode = 16; // 车辆识别码(VIN)
string bmsSoftwareVersion = 17; // BMS软件版本号
optional string additionalInfo = 20; // 附加信息
}
// OTA响应
message OtaResponse {
string pileCode = 1; // 桩编号
bool success = 2;
optional string errorMsg = 3;
}
// 地锁状态上报
message GroundLockStatusProto {
string pileCode = 2; // 桩编号
string gunCode = 3; // 枪号
int32 lockStatus = 4; // 车位锁状态
int32 parkStatus = 5; // 车位状态
int32 lockBattery = 6; // 地锁电量状态 (百分比值0~100)
int32 alarmStatus = 7; // 报警状态
int32 reserved = 8; // 预留位
optional string additionalInfo = 20; // 附加信息
}
// 离线卡余额更新响应
message OfflineCardBalanceUpdateResponse {
string pileCode = 1; // 充电桩编码
string cardNo = 2; // 物理卡号
bool success = 3;
optional string errorMsg = 4;
}
// 离线卡同步响应
message OfflineCardSyncResponse {
string pileCode = 1; // 充电桩编码
bool success = 3;
optional string errorMsg = 4;
}
// 时间同步响应
message TimeSyncResponse {
string pileCode = 1;
string time = 2;
}
// BMS需求充电机输出
message BmsDemandChargerOutputProto {
string pileCode = 4;
string gunCode = 5;
string tradeNo = 6;
optional string additionalInfo = 20;
}