2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
NFC
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このページでは、Cuttlefish の NFC 機能を使って Cuttlefish デバイスで NFC を制御する方法について説明します。NFC は、Android 15 以降を搭載している Cuttlefish デバイスでサポートされています。
Casimir を使用する
Cuttlefish の NFC 機能は Casimir を使用します。Casimir は、外部 NFC デバイスのシミュレーション ツールで、ホストカードのエミュレーション用に APDU バイトを挿入できます。Casimir は /platform/system/nfc/tools/casimir/
に実装されています。
Cuttlefish を起動すると、デフォルトで Casimir も起動します。Casimir の制御には CasimirControlService
サービスを使用します。
CasimirControlService
REST API またはコマンドライン インターフェースを利用して CasimirControlService
サービスを使用できます。詳細については、Cuttlefish: 環境制御をご参照ください。
次の表では CasimirControlService
のメソッドをまとめています。詳細については、casimir_control.proto
をご覧ください。
メソッド |
説明 |
SendApdu
|
NFC-A と ISO-DEP を使って APDU バイト(16 進文字列)を送信します。応答は 16 進文字列で返されます。 |
以下は 2 つの APDU バイト([0x00, 0x11, 0x22]
と [0x33, 0x44, 0x55]
)を送信する場合のコマンドの例と簡略化した応答の例です。
コマンド
cvd env call CasimirControlService SendApdu '{apdu_hex_strings: ["001122", "334455"]}'
簡略化した応答
Rpc succeeded with OK status
{
"responseHexStrings": [
"9000",
"9000",
]
}
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-26 UTC。"],[],[],null,["# NFC\n\nThis page describes how to control NFC on a Cuttlefish device using the\nCuttlefish NFC feature. NFC is supported on Cuttlefish devices running\nAndroid 15 or higher.\n\nUse Casimir\n-----------\n\nThe Cuttlefish NFC feature uses Casimir, an external NFC device simulation tool,\nwhich supports injecting APDU bytes for host card emulation. Casimir is\nimplemented in\n[`/platform/system/nfc/tools/casimir/`](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Nfc/libnfc-nci/tools/casimir/).\n\nWhen launching Cuttlefish, Casimir is also launched by default. To\ncontrol Casimir, use the `CasimirControlService` service.\n\n### CasimirControlService\n\nYou can use the `CasimirControlService` service through the REST API or the\ncommand line interface. For details, see\n[Cuttlefish: Environment Control](/docs/setup/create/cuttlefish-control-environment).\n\nThe following table describes the method in `CasimirControlService`. For\nmore information, see\n[`casimir_control.proto`](https://cs.android.com/android/platform/superproject/+/android-latest-release:device/google/cuttlefish/host/commands/casimir_control_server/casimir_control.proto).\n\n| Method | Description |\n|------------|-------------------------------------------------------------------------------------------------|\n| `SendApdu` | Sends APDU bytes (hex strings) with NFC-A and ISO-DEP. The response is returned as hex strings. |\n\nThe following is an example command and a simplified response for sending two\nAPDU bytes, `[0x00, 0x11, 0x22]` and `[0x33, 0x44, 0x55]`.\n\n- Command\n\n cvd env call CasimirControlService SendApdu '{apdu_hex_strings: [\"001122\", \"334455\"]}'\n\n- Simplified response\n\n Rpc succeeded with OK status\n {\n \"responseHexStrings\": [\n \"9000\",\n \"9000\",\n ]\n }"]]