eya*_*alw 3 macos cocoa bluetooth
有没有办法以编程方式在OS X中设置蓝牙可发现模式(真/假)?
而不是要求用户打开/关闭它?
小智 6
您可以使用OS X私有API IOBluetoothPreferenceSetDiscoverableState.
// Declaration of private API
void IOBluetoothPreferenceSetDiscoverableState(int discoverable);
int IOBluetoothPreferenceGetDiscoverableState();
// Usage
// Turn on Discoverability
IOBluetoothPreferenceSetDiscoverableState(1);
// Get current discoverable state
IOBluetoothPreferenceGetDiscoverableState()
Run Code Online (Sandbox Code Playgroud)
您可能还会发现用于打开和关闭蓝牙的API非常有用:
void IOBluetoothPreferenceSetControllerPowerState(int powered);
int IOBluetoothPreferenceGetControllerPowerState();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1450 次 |
| 最近记录: |