]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
MdePkg/DevicePath: Add BluetoothLe device path node support
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLib / DevicePathFromText.c
index 187c1cc4dc5df3086ca07690d6227cca886bed00..f50c11cfa2e7d593903d5ffc73108b8b5690edee 100644 (file)
@@ -2691,6 +2691,39 @@ DevPathFromTextWiFi (
   return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp;\r
 }\r
 \r
+/**\r
+  Converts a text device path node to Bluetooth LE device path structure.\r
+\r
+  @param TextDeviceNode  The input Text device path node.\r
+\r
+  @return A pointer to the newly-created Bluetooth LE device path structure.\r
+\r
+**/\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+DevPathFromTextBluetoothLE (\r
+  IN CHAR16 *TextDeviceNode\r
+  )\r
+{\r
+  CHAR16                     *BluetoothLeAddrStr;\r
+  CHAR16                     *BluetoothLeAddrTypeStr;\r
+  BLUETOOTH_LE_DEVICE_PATH   *BluetoothLeDp;\r
+\r
+  BluetoothLeAddrStr     = GetNextParamStr (&TextDeviceNode);\r
+  BluetoothLeAddrTypeStr = GetNextParamStr (&TextDeviceNode);\r
+  BluetoothLeDp = (BLUETOOTH_LE_DEVICE_PATH *) CreateDeviceNode (\r
+                                                 MESSAGING_DEVICE_PATH,\r
+                                                 MSG_BLUETOOTH_LE_DP,\r
+                                                 (UINT16) sizeof (BLUETOOTH_LE_DEVICE_PATH)\r
+                                                 );\r
+\r
+  BluetoothLeDp->Address.Type = (UINT8) Strtoi (BluetoothLeAddrTypeStr);\r
+  StrHexToBytes (\r
+    BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2,\r
+    BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address)\r
+    );\r
+  return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp;\r
+}\r
+\r
 /**\r
   Converts a text device path node to URI device path structure.\r
 \r
@@ -3367,6 +3400,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
   {L"Uri",                     DevPathFromTextUri                     },\r
   {L"Bluetooth",               DevPathFromTextBluetooth               },\r
   {L"Wi-Fi",                   DevPathFromTextWiFi                    },\r
+  {L"BluetoothLE",             DevPathFromTextBluetoothLE             },\r
   {L"MediaPath",               DevPathFromTextMediaPath               },\r
   {L"HD",                      DevPathFromTextHD                      },\r
   {L"CDROM",                   DevPathFromTextCDROM                   },\r