ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
NFC
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หน้านี้จะอธิบายวิธีควบคุม NFC ในอุปกรณ์ Cuttlefish โดยใช้ฟีเจอร์ NFC ของ Cuttlefish NFC ใช้งานได้บนอุปกรณ์ Cuttlefish ที่ใช้ Android 15 ขึ้นไป
ใช้ Casimir
ฟีเจอร์ NFC ของ Cuttlefish ใช้ Casimir ซึ่งเป็นเครื่องมือจำลองอุปกรณ์ NFC ภายนอกที่รองรับการแทรกไบต์ APDU สำหรับการจําลองบัตรโฮสต์ Casimir ใช้งานใน /platform/system/nfc/tools/casimir/
เมื่อเปิด Cuttlefish ระบบจะเปิด Casimir โดยค่าเริ่มต้นด้วย หากต้องการควบคุม Casimir ให้ใช้บริการ CasimirControlService
CasimirControlService
คุณใช้บริการ CasimirControlService
ผ่าน REST API หรืออินเทอร์เฟซบรรทัดคำสั่งได้ โปรดดูรายละเอียดที่หัวข้อCuttlefish: การควบคุมสภาพแวดล้อม
ตารางต่อไปนี้อธิบายเมธอดใน CasimirControlService
ดูข้อมูลเพิ่มเติมได้ที่ casimir_control.proto
วิธีการ |
คำอธิบาย |
SendApdu
|
ส่งไบต์ APDU (สตริงฐาน 16) ด้วย NFC-A และ ISO-DEP ระบบจะแสดงผลลัพธ์เป็นสตริงฐาน 16 |
ต่อไปนี้เป็นตัวอย่างคำสั่งและการตอบกลับแบบง่ายสำหรับการส่งไบต์ APDU 2 รายการ ได้แก่ [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-07-27 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-07-27 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 }"]]