-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from nefarius/nefarius/feature/bluetooth
Added Bluetooth utility commands
- Loading branch information
Showing
11 changed files
with
170 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "vcpkg"] | ||
path = vcpkg | ||
url = https://github.com/microsoft/vcpkg.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<Project> | ||
<Import Project="$(MSBuildThisFileDirectory)vcpkg\scripts\buildsystems\msbuild\vcpkg.props" Condition="'$(CI)' != 'true'" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project> | ||
<Import Project="$(MSBuildThisFileDirectory)vcpkg\scripts\buildsystems\msbuild\vcpkg.targets" Condition="'$(CI)' != 'true'" /> | ||
<ItemDefinitionGroup Condition="'$(CI)' != 'true' AND !Exists('$(MSBuildThisFileDirectory)/vcpkg/vcpkg.exe')"> | ||
<PreBuildEvent> | ||
<Command>$(MSBuildThisFileDirectory)vcpkg\bootstrap-vcpkg.bat</Command> | ||
<Message>Bootstrap vcpkg</Message> | ||
</PreBuildEvent> | ||
</ItemDefinitionGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#pragma once | ||
|
||
#include <bluetoothapis.h> | ||
#include <newdev.h> | ||
|
||
#include <type_traits> | ||
|
||
class ProcPtr { | ||
public: | ||
explicit ProcPtr(FARPROC ptr) : _ptr(ptr) {} | ||
|
||
template <typename T, typename = std::enable_if_t<std::is_function_v<T>>> | ||
operator T* () const { | ||
return reinterpret_cast<T*>(_ptr); | ||
} | ||
|
||
private: | ||
FARPROC _ptr; | ||
}; | ||
|
||
class DllHelper { | ||
public: | ||
explicit DllHelper(LPCTSTR filename) : _module(LoadLibrary(filename)) {} | ||
|
||
~DllHelper() { FreeLibrary(_module); } | ||
|
||
ProcPtr operator[](LPCSTR proc_name) const { | ||
return ProcPtr(GetProcAddress(_module, proc_name)); | ||
} | ||
|
||
static HMODULE _parent_module; | ||
|
||
private: | ||
HMODULE _module; | ||
}; | ||
|
||
|
||
class Bthprops { | ||
DllHelper _dll{ L"BluetoothApis.dll" }; | ||
|
||
public: | ||
decltype(BluetoothFindFirstRadio)* pBluetoothFindFirstRadio = _dll["BluetoothFindFirstRadio"]; | ||
decltype(BluetoothFindRadioClose)* pBluetoothFindRadioClose = _dll["BluetoothFindRadioClose"]; | ||
decltype(BluetoothSetLocalServiceInfo)* pBluetoothSetLocalServiceInfo = _dll["BluetoothSetLocalServiceInfo"]; | ||
}; | ||
|
||
class Newdev { | ||
DllHelper _dll{ L"Newdev.dll" }; | ||
|
||
public: | ||
decltype(DiUninstallDriverW)* pDiUninstallDriverW = _dll["DiUninstallDriverW"]; | ||
decltype(DiInstallDriverW)* pDiInstallDriverW = _dll["DiInstallDriverW"]; | ||
decltype(DiUninstallDevice)* pDiUninstallDevice = _dll["DiUninstallDevice"]; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters