feat(scanner): more work on the scanner and can now scan to prod no lst right now
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 2m41s

This commit is contained in:
2026-04-25 18:13:07 -05:00
parent 83a542d1b7
commit 77b4533dea
17 changed files with 615 additions and 43 deletions

View File

@@ -0,0 +1,24 @@
import React from 'react'
import { View, Text } from 'react-native'
export default function LSTScanner() {
return (
<View><View style={{ alignItems: "center", margin: 10 }}>
<Text style={{ fontSize: 20, fontWeight: "600" }}>LST Scanner</Text>
</View>
<View
style={{
marginTop: 50,
alignItems: "center",
}}
>
<Text>Relocate</Text>
<Text>0 / 4</Text>
</View>
{/* <View>
<Text>List of recent scanned pallets TBA</Text>
</View> */}
</View>
)
}

View File

@@ -0,0 +1,31 @@
import React from 'react'
import { View, Text } from 'react-native'
import { ScannerTestScreen } from './ScannExample'
import { useAppStore } from '../hooks/useAppStore';
export default function ProdScanner() {
const scannerIdFromStore = useAppStore((s) => s.scannerId);
return (
<View>
<View style={{ alignItems: "center", margin: 10 }}>
<Text style={{ fontSize: 20, fontWeight: "600" }}>SScanner ID: {scannerIdFromStore}</Text>
</View>
<View
style={{
marginTop: 50,
alignItems: "center",
}}
>
<Text>Relocate</Text>
<Text>0 / 4</Text>
</View>
{/* <View>
<Text>List of recent scanned pallets TBA</Text>
</View> */}
<ScannerTestScreen />
</View>
)
}

View File

@@ -0,0 +1,58 @@
import { useEffect, useState } from "react";
import { Button, Text, View } from "react-native";
import { type ZebraScanResult, zebraScanner } from "../lib/ZebraScanner";
const STX = "\x02";
const ETX = "\x03";
export function ScannerTestScreen() {
const [lastResponse, setLastResponse] = useState("");
const handleScan = async (scan: ZebraScanResult) => {
console.log("Raw Zebra scan:", scan);
const scanned = scan.data;
// Hard-coded command example:
// <stx>98@{scanned}<etx>
const tcpMessage = `${STX}98@${scanned}${ETX}`;
console.log("TCP message to send:", tcpMessage);
console.log("TCP message visible:", `<stx>98@${scanned}<etx>`);
// Later this is where your TCP send goes.
// const response = await sendTcpMessage(tcpMessage);
const fakeResponse = `Would send TCP: <stx>98@${scanned}<etx>`;
console.log("TCP response:", fakeResponse);
setLastResponse(fakeResponse);
};
useEffect(() => {
zebraScanner.ensureProfile();
zebraScanner.startListening();
const sub = zebraScanner.addScanListener((scan) => {
console.log("SCAN:", scan);
handleScan(scan);
});
return () => {
sub.remove();
zebraScanner.stopListening();
};
}, []);
return (
<View style={{ padding: 20, gap: 12 }}>
<Button
title="Soft Trigger Scan"
onPress={() => zebraScanner.triggerScan()}
/>
<Text>Waiting for scan...</Text>
<Text>{lastResponse}</Text>
</View>
);
}