Security cameras use an Ambient Light Sensor (ALS) to decide whether to switch into night mode. In production, a background polling thread continuously reads the sensor and sends readings to a wrapper. Other threads should be able to query the wrapper safely without waiting for the sensor.
Each reading has a status, lux, and timestamp.
status == 1: the reading is valid. Record this(timestamp, lux)reading.status == 0: the sensor reports no change. Ignore this reading completely.
You need to implement the ALSWrapper class with thread-safe, non-blocking query support. In real production, the wrapper may receive frequent records from one or more sensors while other threads are querying it at the same time.
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected