feat(felica): update station label handling for non-transit process types

This commit is contained in:
harukin-expo-dev-env
2026-03-14 17:23:24 +00:00
parent a068dabc75
commit 7386ec09fc

View File

@@ -26,6 +26,19 @@ const PROCESS_TYPE_LABEL: Record<number, string> = {
0x62: "チャージ",
};
// byte[6-9] が駅コードではなく端末ID等として使われる processType
// (metrodroid の isProductSale / CONSOLE_CHARGE 相当)
// terminalType (byte[0]) が 0xC7(POS) / 0xC8(自販機) の場合も同様
const NON_TRANSIT_PROCESS_TYPES = new Set([
0x46, // 物販
0x62, // チャージ
0x14, // タクシー
]);
const NON_TRANSIT_TERMINAL_TYPES = new Set([
0xc7, // POS端末
0xc8, // 自動販売機
]);
function processLabel(processType: number): string {
return PROCESS_TYPE_LABEL[processType] ?? `0x${processType.toString(16).toUpperCase().padStart(2, "0")}`;
}
@@ -42,8 +55,13 @@ function HistoryRow({ entry, index }: { entry: FelicaHistoryEntry; index: number
const label = processLabel(entry.processType);
const regionCode = entry.regionCode ?? 0;
const inStationLabel = stationLabel(regionCode, entry.inLineCode, entry.inStationCode);
const outStationLabel = stationLabel(regionCode, entry.outLineCode, entry.outStationCode);
// 物販・チャージ・POS端末などの場合は byte[6-9] が駅コードではないので表示しない
const isTransit =
!NON_TRANSIT_PROCESS_TYPES.has(entry.processType) &&
!NON_TRANSIT_TERMINAL_TYPES.has(entry.terminalType);
const inStationLabel = isTransit ? stationLabel(regionCode, entry.inLineCode, entry.inStationCode) : "";
const outStationLabel = isTransit ? stationLabel(regionCode, entry.outLineCode, entry.outStationCode) : "";
const showStations = inStationLabel !== "" || outStationLabel !== "";
return (