Skip to content

Commit 659e727

Browse files
committed
all services
1 parent fafee84 commit 659e727

File tree

3 files changed

+92
-56
lines changed

3 files changed

+92
-56
lines changed

src/pages/logs.tsx

Lines changed: 6 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,61 +7,11 @@ import { TopAppBar } from '../components/TopAppBar'
77
import { Select } from '../components/Select'
88
import { BackButton } from '../components/BackButton'
99
import { useLocation, useSearchParams } from 'react-router-dom'
10-
import { z } from 'zod'
1110
import { Toggle } from '../components/Toggle'
1211
import { FILE_INFO } from '../components/RouteFiles'
12+
import { capitalize } from '../utils/helpers'
13+
import { Service } from '../types'
1314

14-
const LogEvent = z.enum([
15-
'Sentinel',
16-
'AndroidLog',
17-
'Can',
18-
'DeviceState',
19-
'ErrorLogMessage',
20-
'LogMessage',
21-
'ManagerState',
22-
'PandaStates',
23-
'PeripheralState',
24-
'ProcLog',
25-
'UiDebug',
26-
'Accelerometer',
27-
'Gyroscope',
28-
'Magnetometer',
29-
'TemperatureSensor',
30-
'Clocks',
31-
'SoundPressure',
32-
'DriverCameraState',
33-
'WideRoadCameraState',
34-
'RoadCameraState',
35-
'DriverEncodeIdx',
36-
'RoadEncodeIdx',
37-
'WideRoadEncodeIdx',
38-
'QcomGnss',
39-
'CarOutput',
40-
'CarParams',
41-
'CarState',
42-
'SelfdriveState',
43-
'LiveCalibration',
44-
'OnroadEvents',
45-
'LiveTracks',
46-
'CarControl',
47-
'ControlsState',
48-
'LiveTorqueParameters',
49-
'LiveDelay',
50-
'RadarState',
51-
'ModelV2',
52-
'CameraOdometry',
53-
'DrivingModelData',
54-
'LivePose',
55-
'LongitudinalPlan',
56-
'DriverAssistance',
57-
'LiveParameters',
58-
'DriverStateV2',
59-
'DriverMonitoringState',
60-
'Sendcan',
61-
'Thumbnail',
62-
'GpsLocation',
63-
])
64-
type LogEvent = z.infer<typeof LogEvent>
6515

6616
const SyntaxHighlightedJson = ({ json }: { json: string }) => {
6717
if (!json) return null
@@ -115,7 +65,7 @@ export const Component = () => {
11565
const type: 'qlogs' | 'logs' = location.pathname.includes('qlogs') ? 'qlogs' : 'logs'
11666

11767
const segment = Number(params.get('segment')) || 0
118-
const eventName = (params.get('eventName') as LogEvent) || 'CarState'
68+
const eventName: Service = (params.get('eventName') as Service) || 'carState'
11969
const limit = Number(params.get('limit')) || 10
12070
const prettify = params.get('prettify') !== 'false'
12171

@@ -136,11 +86,11 @@ export const Component = () => {
13686
let count = 0
13787
const data = []
13888
for await (const event of reader) {
139-
if (!(eventName in event)) continue
89+
if (!(capitalize(eventName) in event)) continue
14090
if (count >= limit) break
14191
console.log()
14292
const LogMonoTime = Number(new BigUint64Array(event.LogMonoTime.buffer.buffer).at(0)! / 1_000_000n)
143-
data.push({ LogMonoTime, ...event[eventName] })
93+
data.push({ LogMonoTime, ...event[capitalize(eventName)] })
14494

14595
count++
14696
}
@@ -177,7 +127,7 @@ export const Component = () => {
177127
<Select
178128
value={eventName}
179129
onChange={(value) => updateParam('eventName', value)}
180-
options={LogEvent.options.map((x) => ({ value: x, label: x }))}
130+
options={Service.options.map((x) => ({ value: x, label: x }))}
181131
className="min-w-[200px]"
182132
/>
183133

src/types.ts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,92 @@ export const RenderInfo = z.object({
253253
state: z.enum(['started', 'generating', 'downloading', 'rendering', 'done', 'error']),
254254
output: z.string().optional(),
255255
})
256+
export const Service = z.enum([
257+
'gyroscope',
258+
'gyroscope2',
259+
'accelerometer',
260+
'accelerometer2',
261+
'magnetometer',
262+
'lightSensor',
263+
'temperatureSensor',
264+
'temperatureSensor2',
265+
'gpsNMEA',
266+
'deviceState',
267+
'touch',
268+
'can',
269+
'controlsState',
270+
'selfdriveState',
271+
'pandaStates',
272+
'peripheralState',
273+
'radarState',
274+
'roadEncodeIdx',
275+
'liveTracks',
276+
'sendcan',
277+
'logMessage',
278+
'errorLogMessage',
279+
'liveCalibration',
280+
'liveTorqueParameters',
281+
'liveDelay',
282+
'androidLog',
283+
'carState',
284+
'carControl',
285+
'carOutput',
286+
'longitudinalPlan',
287+
'driverAssistance',
288+
'procLog',
289+
'gpsLocationExternal',
290+
'gpsLocation',
291+
'ubloxGnss',
292+
'qcomGnss',
293+
'gnssMeasurements',
294+
'clocks',
295+
'ubloxRaw',
296+
'livePose',
297+
'liveParameters',
298+
'cameraOdometry',
299+
'thumbnail',
300+
'onroadEvents',
301+
'carParams',
302+
'roadCameraState',
303+
'driverCameraState',
304+
'driverEncodeIdx',
305+
'driverStateV2',
306+
'driverMonitoringState',
307+
'wideRoadEncodeIdx',
308+
'wideRoadCameraState',
309+
'drivingModelData',
310+
'modelV2',
311+
'managerState',
312+
'uploaderState',
313+
'navInstruction',
314+
'navRoute',
315+
'navThumbnail',
316+
'qRoadEncodeIdx',
317+
'userBookmark',
318+
'soundPressure',
319+
'rawAudioData',
320+
'bookmarkButton',
321+
'audioFeedback',
322+
'uiDebug',
323+
'testJoystick',
324+
'alertDebug',
325+
'roadEncodeData',
326+
'driverEncodeData',
327+
'wideRoadEncodeData',
328+
'qRoadEncodeData',
329+
'livestreamWideRoadEncodeIdx',
330+
'livestreamRoadEncodeIdx',
331+
'livestreamDriverEncodeIdx',
332+
'livestreamWideRoadEncodeData',
333+
'livestreamRoadEncodeData',
334+
'livestreamDriverEncodeData',
335+
'customReservedRawData0',
336+
'customReservedRawData1',
337+
'customReservedRawData2',
338+
])
256339

257340
// TYPES
341+
export type Service = z.infer<typeof Service>
258342
export type Profile = z.infer<typeof Profile>
259343
export type DeviceLocation = z.infer<typeof DeviceLocation>
260344
export type Device = z.infer<typeof Device>

src/utils/helpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,5 @@ export const concatBins = (chunks: Uint8Array[]) => {
106106

107107
return result
108108
}
109+
110+
export const capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)

0 commit comments

Comments
 (0)