jsaddle-dom-0.10.0.0: src/JSDOM/Generated/SerialPortRequestOptions.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from serial (webref). Do not edit.
module JSDOM.Generated.SerialPortRequestOptions
(newSerialPortRequestOptions, setFilters, getFilters, getFiltersUnsafe, getFiltersUnchecked, setAllowedBluetoothServiceClassIds, getAllowedBluetoothServiceClassIds, getAllowedBluetoothServiceClassIdsUnsafe, getAllowedBluetoothServiceClassIdsUnchecked, SerialPortRequestOptions(..), gTypeSerialPortRequestOptions)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums
-- | <https://serial.spec.whatwg.org/#dictdef-serialportrequestoptions SerialPortRequestOptions specification>
newSerialPortRequestOptions :: (MonadDOM m) => m SerialPortRequestOptions
newSerialPortRequestOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-filters SerialPortRequestOptions.filters specification>
setFilters :: (MonadDOM m) => SerialPortRequestOptions -> [SerialPortFilter] -> m ()
setFilters self val = liftDOM (void (self ^. jss "filters" (toJSVal val)))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-filters SerialPortRequestOptions.filters specification>
getFilters :: (MonadDOM m) => SerialPortRequestOptions -> m (Maybe [SerialPortFilter])
getFilters self = liftDOM (((self ^. js "filters") >>= fromJSValUnchecked))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-filters SerialPortRequestOptions.filters specification>
getFiltersUnsafe :: (MonadDOM m, HasCallStack) => SerialPortRequestOptions -> m [SerialPortFilter]
getFiltersUnsafe self = liftDOM ((((self ^. js "filters") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-filters SerialPortRequestOptions.filters specification>
getFiltersUnchecked :: (MonadDOM m) => SerialPortRequestOptions -> m [SerialPortFilter]
getFiltersUnchecked self = liftDOM (((self ^. js "filters") >>= fromJSValUnchecked))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-allowedbluetoothserviceclassids SerialPortRequestOptions.allowedBluetoothServiceClassIds specification>
setAllowedBluetoothServiceClassIds :: (MonadDOM m, IsBluetoothServiceUUID val) => SerialPortRequestOptions -> [val] -> m ()
setAllowedBluetoothServiceClassIds self val = liftDOM (void (self ^. jss "allowedBluetoothServiceClassIds" (toJSVal val)))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-allowedbluetoothserviceclassids SerialPortRequestOptions.allowedBluetoothServiceClassIds specification>
getAllowedBluetoothServiceClassIds :: (MonadDOM m) => SerialPortRequestOptions -> m (Maybe [BluetoothServiceUUID])
getAllowedBluetoothServiceClassIds self = liftDOM (((self ^. js "allowedBluetoothServiceClassIds") >>= fromJSValUnchecked))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-allowedbluetoothserviceclassids SerialPortRequestOptions.allowedBluetoothServiceClassIds specification>
getAllowedBluetoothServiceClassIdsUnsafe :: (MonadDOM m, HasCallStack) => SerialPortRequestOptions -> m [BluetoothServiceUUID]
getAllowedBluetoothServiceClassIdsUnsafe self = liftDOM ((((self ^. js "allowedBluetoothServiceClassIds") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-allowedbluetoothserviceclassids SerialPortRequestOptions.allowedBluetoothServiceClassIds specification>
getAllowedBluetoothServiceClassIdsUnchecked :: (MonadDOM m) => SerialPortRequestOptions -> m [BluetoothServiceUUID]
getAllowedBluetoothServiceClassIdsUnchecked self = liftDOM (((self ^. js "allowedBluetoothServiceClassIds") >>= fromJSValUnchecked))