Object-Oriented Programming · Verkada · Medium
Problem An Ambient Light Sensor (ALS) determines when a security camera should enter night mode. In production, a background polling thread repeatedly obtains sensor readings and passes them to a wrapper, while other threads must be able to query that wrapper safely without waiting for the sensor. Every sensor reading contains a status, a lux value, and a timestamp. When status == 1, the reading is valid and its (timestamp, lux) pair must be retained. When status == 0, the…