ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/SerialPortRequestOptions.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from serial (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.SerialPortRequestOptions
(js_newSerialPortRequestOptions, js_setFilters, js_getFilters, js_setAllowedBluetoothServiceClassIds, js_getAllowedBluetoothServiceClassIds, 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 GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript safe "(() => { return ({}); })"
js_newSerialPortRequestOptions :: IO SerialPortRequestOptions
-- | <https://serial.spec.whatwg.org/#dictdef-serialportrequestoptions SerialPortRequestOptions specification>
newSerialPortRequestOptions :: (MonadDOM m) => m SerialPortRequestOptions
newSerialPortRequestOptions = liftDOM ((js_newSerialPortRequestOptions))
foreign import javascript safe "(($1, $2) => { $1[\"filters\"] = $2; })"
js_setFilters :: SerialPortRequestOptions -> JSVal -> IO ()
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-filters SerialPortRequestOptions.filters specification>
setFilters :: (MonadDOM m) => SerialPortRequestOptions -> [SerialPortFilter] -> m ()
setFilters self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setFilters (self) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"filters\"]; })"
js_getFilters :: SerialPortRequestOptions -> IO JSVal
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-filters SerialPortRequestOptions.filters specification>
getFilters :: (MonadDOM m) => SerialPortRequestOptions -> m (Maybe [SerialPortFilter])
getFilters self = liftDOM (((js_getFilters (self)) >>= fromJSValUnchecked))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-filters SerialPortRequestOptions.filters specification>
getFiltersUnsafe :: (MonadDOM m, HasCallStack) => SerialPortRequestOptions -> m [SerialPortFilter]
getFiltersUnsafe self = liftDOM ((((js_getFilters (self)) >>= 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 (((js_getFilters (self)) >>= fromJSValUnchecked))
foreign import javascript safe "(($1, $2) => { $1[\"allowedBluetoothServiceClassIds\"] = $2; })"
js_setAllowedBluetoothServiceClassIds :: SerialPortRequestOptions -> JSVal -> IO ()
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-allowedbluetoothserviceclassids SerialPortRequestOptions.allowedBluetoothServiceClassIds specification>
setAllowedBluetoothServiceClassIds :: (MonadDOM m, IsBluetoothServiceUUID val) => SerialPortRequestOptions -> [val] -> m ()
setAllowedBluetoothServiceClassIds self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setAllowedBluetoothServiceClassIds (self) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"allowedBluetoothServiceClassIds\"]; })"
js_getAllowedBluetoothServiceClassIds :: SerialPortRequestOptions -> IO JSVal
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-allowedbluetoothserviceclassids SerialPortRequestOptions.allowedBluetoothServiceClassIds specification>
getAllowedBluetoothServiceClassIds :: (MonadDOM m) => SerialPortRequestOptions -> m (Maybe [BluetoothServiceUUID])
getAllowedBluetoothServiceClassIds self = liftDOM (((js_getAllowedBluetoothServiceClassIds (self)) >>= fromJSValUnchecked))
-- | <https://serial.spec.whatwg.org/#dom-serialportrequestoptions-allowedbluetoothserviceclassids SerialPortRequestOptions.allowedBluetoothServiceClassIds specification>
getAllowedBluetoothServiceClassIdsUnsafe :: (MonadDOM m, HasCallStack) => SerialPortRequestOptions -> m [BluetoothServiceUUID]
getAllowedBluetoothServiceClassIdsUnsafe self = liftDOM ((((js_getAllowedBluetoothServiceClassIds (self)) >>= 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 (((js_getAllowedBluetoothServiceClassIds (self)) >>= fromJSValUnchecked))