OgpSdk

class OgpSdk(dispatcher: CoroutineDispatcher, appContext: OgpSdkAppContext)

The top level SDK interface

The client should use this class to discover, connect, and retrieve GoPro objects

TODO currently multiple instances of OGP SDK are not supported and have not been tested.

// Initialize OGP SDK
val ogpSdk = OgpSdk(dispatcher, appContext)

coroutineScope.launch {
// Discover and take the first device we find
val target = ogpSdk.discover(NetworkType.BLE).first()

// Connect
val goproId = ogpSdk.connect(target).getOrThrow()

// Now retrieve the gopro
val gopro = ogpSdk.getGoPro(goproId)

// Set the shutter
gopro.commands.setShutter(true)
}

Parameters

dispatcher

dispatcher that OGP SDK should use for coroutine scopes

appContext

platform-specific application context

Constructors

Link copied to clipboard
constructor(dispatcher: CoroutineDispatcher, appContext: OgpSdkAppContext)

Functions

Link copied to clipboard
suspend fun connect(target: ScanResult, connectionRequestContext: ConnectionRequestContext? = null): Result<GoProId>

Establish a connection to a discovered GoPro

Link copied to clipboard
suspend fun discover(vararg networkTypes: NetworkType): Flow<ScanResult>

Scan for available GoPro's on one or more network types

Link copied to clipboard
suspend fun getGoPro(id: GoProId): Result<GoPro>

Retrieve a connected GoPro instance