yeg
2026-09-09 f38ca8a9f8454ac2eebdc268c89efd0e436b3cf2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.battery.device.bts;
 
import java.util.Locale;
import java.util.Set;
import com.battery.device.api.StepDirectionResolver;
 
/** BTS 类型解释仅留在协议模块,供已保存实际工步的报表读取使用。 */
public final class BtsStepDirectionResolver implements StepDirectionResolver
{
    /** 按《BTS API技术协议》2.2 识别;pcccv、工况和脉冲未明确单向,不猜测。 */
    @Override
    public Direction resolve(String stepType)
    {
        String type = stepType == null ? "" : stepType.trim().toLowerCase(Locale.ROOT);
        if ("rest".equals(type)) return Direction.REST;
        if (Set.of("cc", "cv", "cccv", "cp", "cr", "charge", "charging").contains(type)) return Direction.CHARGE;
        if (Set.of("dc", "dp", "dr", "dv", "cccd", "discharge", "discharging").contains(type)) return Direction.DISCHARGE;
        return Direction.UNKNOWN;
    }
}