Browse Source

change: bluetooth,获取mac地址的函数名改短,补充增加API的日期

Wendal Chen 5 tháng trước cách đây
mục cha
commit
cff3963e38
1 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 5 4
      components/bluetooth/src/luat_lib_bluetooth.c

+ 5 - 4
components/bluetooth/src/luat_lib_bluetooth.c

@@ -155,11 +155,12 @@ static int l_bluetooth_create_ble(lua_State* L) {
 
 /*
 获取蓝牙MAC
-@api bluetooth.getMac()
+@api bluetooth.mac()
 @return string 当前的MAC
 @usage
-local mac = bluetooth.getMac()
-log.info("bluetooth mac", mac:toHex())
+-- 本函数于2025.8.14新增
+local mac = bluetooth.mac()
+log.info("bluetooth mac", mac and mac:toHex())
 */
 static int l_bluetooth_get_mac(lua_State *L){
 	uint8_t mac[6] = {0};
@@ -182,7 +183,7 @@ void luat_bluetooth_struct_init(lua_State *L) {
 static const rotable_Reg_t reg_bluetooth[] = {
 	{"init",                        ROREG_FUNC(l_bluetooth_init)},
     {"ble",                         ROREG_FUNC(l_bluetooth_create_ble)},
-    {"getMac",                      ROREG_FUNC(l_bluetooth_get_mac)},
+    {"mac",                         ROREG_FUNC(l_bluetooth_get_mac)},
 	{ NULL,                         ROREG_INT(0)}
 };