スタートガイド
このプラグインのインストール、同期、そして完全なマークダウンガイドの設定用の質問をコピーする
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-uwb`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/uwb/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションCapgoのAI-Assisted Setupを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-uwb` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-uwbbunx cap syncインポート
「インポート」のセクションimport { CapacitorUwb } from '@capgo/capacitor-uwb';利用可能性を確認
「利用可能性を確認」のセクションconst availability = await CapacitorUwb.isAvailable();
if (!availability.supported) { console.log('This device does not support UWB.');}iOS ペア セッション
「iOS ペア セッション」のセクション- コール
getDiscoveryToken()コンテキスト: Appflow 比較 / 移行マーケティングコピー (親キー `appflow_migration_step2`). - 両方のデバイスで。
- ペアトークンで範囲を開始してください。
const { discoveryToken } = await CapacitorUwb.getDiscoveryToken();
await CapacitorUwb.startPeerSession({ peerDiscoveryToken: '<peer-token-base64>',});参照 iOS設定 機能とパーミッションの要件については
Android Controller / Controlee セッション
セクション「Android Controller / Controlee セッション」- コントローラーは
startControllerSession()と共有します。rangingParametersコントローラーはlocalAddress. - と共有します。
rangingParametersコントローラーは、localAddressaspeerAddress. - コントロールされる側は
startControleeSession({ rangingParameters }). - オプションで、コントロールされる側のアドレスがわかったらコントローラーに渡す
peerAddressコピー
const controller = await CapacitorUwb.startControllerSession();
await CapacitorUwb.startControleeSession({ rangingParameters: { ...controller.rangingParameters, peerAddress: controller.localAddress, },});Androidの設定 ハードウェアと権限の要件については 更新を待つ
「更新を待つ」のセクション
セッションを停止await CapacitorUwb.addListener('rangingUpdate', (event) => { console.log(event.distanceMeters, event.direction);});
await CapacitorUwb.addListener('sessionStateChanged', (event) => { console.log(event.state, event.reason);});Copy to clipboard
セクションのタイトル “セッションを停止”await CapacitorUwb.stopSession();このページはプラグインの src/definitions.tsTypeScript定義を更新し、生成された bun run docgen プラグインリポジトリにアクセスして、生成されたAPIドキュメントを更新してください。