Skip to main content

High-level Facades

The Plaud Embedded iOS SDK has a set of high-level interfaces for basic usage. These include:
  1. PlaudDeviceAgent
  2. PlaudWiFiAgent
These high-level methods and callbacks in these facades should cover most use cases including:
  1. Device Connection: Connecting to & disconnecting from Plaud devices via mobile app
  2. File Management: Syncing files from Plaud device to mobile app
  3. Firmware Updates: Updating Plaud device firmware
See our iOS SDK reference for examples and documentation on these high-level facades.
Additionally, using PlaudDeviceAgent & PlaudWiFiAgent abstracts many details that low-level interfaces will not handle.
You can mix high-level and low-level facades. For example if there’s a behavior that PlaudDeviceAgent does not include, you can use BleAgent to cover that functionality.

Low-level Facades

The iOS SDK has a few lower-level interfaces that our high-level interfaces (PlaudDeviceAgent and PlaudWiFiAgent) wrap over:
  1. BleAgent: Bluetooth Low Energy (BLE) transport
  2. WiFiAgent: WiFi agent with low-level methods for WiFi fast transfers
  3. PlaudPartnerApiManager: Manages the backend endpoints for device signing and RSA keypair generation
We do not recommend using these low-level facades as main drivers. Use them as coverage for functionality not exposed by PlaudDeviceAgent and PlaudWiFiAgent.

BleAgent Reference

Import BleAgent through PlaudDeviceBasicSDK. You can then access BleAgent through the shared singleton or through the facade’s escape hatch:
Swift

BleAgent State

Read-only state is available directly on the agent, which is useful when you need a synchronous answer rather than waiting for a delegate callback:

Device Connection

Swift
BleDevice
required
The device to connect to, as delivered by bleScanResult(bleDevices:).
String?
default:"nil"
Per-device token. The facade passes the user identifier here and rejects an empty string by emitting bleConnectState(state: 2); the low-level agent performs no such validation.
String?
default:"nil"
Owner name written to the device. The facade passes "Plaud".
Bool
required
Clear any existing pairing before connecting. The facade passes false.
Other lifecycle and auth methods on BleAgent:
Swift
BleAgent.connectBleDevice(...) does not run the partner pre-handshake, so connecting a protocol V20+ device (NotePro and newer) through the low-level agent fails unless you inject the handshake material yourself. See Device Security.

Recording & Device State

Swift
BleAgent also exposes the full device-settings surface that the facade only partially wraps. Each setting is a read… / set… pair, with the result delivered on the corresponding BleAgentProtocol callback.
Swift
Most setters ship in two forms: an @objc variant taking a raw Int (e.g. setRecScene(value: Int)) and a Swift-only variant taking a typed enum (setRecScene(type: RecScene)). Prefer the typed variant.

File Sync

Swift
Int
required
Request identifier echoed back on the response. The facade passes a timestamp.
Int
required
On getFileList, the session ID to start listing from. On syncFile / deleteFile, the recording to act on.
Bool
default:"false"
Return a single file rather than the list from sessionId onward. This is what PlaudDeviceAgent.getFile(sessionId:) sets.
Int
required
Start byte offset. Use 0 for the whole file, or a BleFile.offset to resume.
Int
required
End byte offset. 0 transfers to the end of the file.
Bool
required
Decode the stream in transit. Pass false for E2EE (protocol V20+) devices and decrypt the result yourself; true otherwise.
File bytes arrive on bleData(sessionId:start:data:) and finish with bleDataComplete(). There is no format conversion at this layer — that is what PlaudDeviceAgent.exportAudio(...) adds on top.
On a protocol V20+ device, syncFile(decode: true) returns bytes that are still E2EE-encrypted. Sync with decode: false and pass the file through AudioFileDecryptor.decryptAudioFile(inputPath:privateKeyPem:) using the private key from gen-key, or use PlaudDeviceAgent.syncFile(...), which does this for you.

Firmware Push

Swift

Encryption

Swift

WiFiAgent Reference

WiFi Fast Transfer

Each PlaudWiFiAgent method maps to a single WiFiAgent command: The flow is the same as the high-level PlaudWiFiAgent: open the device hotspot, then hand the device to the WiFi layer and wait for wifiHandshake(0) before issuing any file command.
Swift
String
required
The device hotspot SSID, delivered as wifiName on bleWiFiOpen(_:_:_:_:).
String
required
The hotspot passphrase, delivered as wifiPass on bleWiFiOpen(_:_:_:_:).
Int
default:"60"
Association timeout in seconds. listenPort(_:_:) defaults to 30.
Int
default:"1"
On appSyncFile / appStopSyncFile / appDeleteFile, the file’s own BleFile.scenes value. A mismatch is rejected by the device with a non-zero wifiSyncFile status.
Additional transport controls not surfaced on the facade:
Swift

WiFiAgentProtocol

WiFiAgentProtocol is the low-level delegate. Unlike PlaudWiFiAgentProtocol, which is entirely optional, most of WiFiAgentProtocol are required.
wifiCommonErr(cmd: 16, status: 0) at the end of a transfer is expected and indicates a successful sync.

PlaudPartnerApiManager

PlaudPartnerApiManager wraps the partner authentication endpoints. Like BleAgent, reach it via the facade or the singleton:
Swift
Swift
There is no sn-verify method on iOS. Signature verification happens on the device during the BLE pre-handshake, not through a client API call.

Device Security

Partner endpoints for device authentication: The high-level PlaudDeviceAgent drives this entire flow. You only need these APIs if you are connecting through BleAgent directly or minting keys on your own backend.
1

At init — gen-key

initSDK(userAccessToken:customDomain:) and every setUserAccessToken(_:) call fetch a fresh RSA key pair, store it, and mirror it into the BLE layer. A new key pair invalidates every cached sn-sign signature, since signatures are bound to the key pair that produced them.A response missing private_key is a hard failure — the public key alone is not enough to complete the encrypted pre-handshake.
2

Before connect — sn-sign

connectBleDevice(...) runs the partner handshake before it reaches BleAgent:
3

After sync — E2EE decryption

Methods like PlaudDeviceAgent.syncFile(...) will use the symmetric key from the encrypted file header before decoding audio.