diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-08-20 02:23:39 +0000 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-08-23 22:59:12 +0000 |
commit | 6db2d77345b1d3da432a73d9eaf0be34165567c3 (patch) | |
tree | 0bc2606a60a3458aacb04fd5c3765d2554295e81 /hsm-cam/Test | |
parent | 5a78bc1885ad7d6fd7ad63d6ef900188ab38a80c (diff) |
Adds camera service
Diffstat (limited to 'hsm-cam/Test')
-rw-r--r-- | hsm-cam/Test/Cam.hs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/hsm-cam/Test/Cam.hs b/hsm-cam/Test/Cam.hs index 4cf9e7f..9b06785 100644 --- a/hsm-cam/Test/Cam.hs +++ b/hsm-cam/Test/Cam.hs @@ -1,8 +1,16 @@ +import Control.Monad (forM_) +import Data.ByteString.Lazy (writeFile) import Data.Function ((&)) -import Effectful (runEff) -import Effectful.Resource (runResource) -import Hsm.Cam (runCam, stillCapture) -import Hsm.Log (Severity (Trace), runLog) +import Effectful (liftIO, runEff) +import Hsm.Cam (capturePng, runCam) +import Hsm.Log (Severity(Info, Trace), logMsg, runLog) +import Prelude hiding (writeFile) main :: IO () -main = stillCapture & runCam & runLog @"cam" Trace & runResource & runEff +main = forM_ [0 .. 31] savePng & runCam & runLog @"cam" Trace & runEff + where + savePng index = do + logMsg Info $ "Saving image to file: " <> path + capturePng >>= liftIO . writeFile path + where + path = "/tmp/hsm-cam-test" <> show @Int index <> ".png" |