aboutsummaryrefslogtreecommitdiff
path: root/hsm-cam/Test/Cam.hs
blob: 9b067851f90ec31cecf633cc57fd623b2ae3fdfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import Control.Monad (forM_)
import Data.ByteString.Lazy (writeFile)
import Data.Function ((&))
import Effectful (liftIO, runEff)
import Hsm.Cam (capturePng, runCam)
import Hsm.Log (Severity(Info, Trace), logMsg, runLog)
import Prelude hiding (writeFile)

main :: IO ()
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"