Skip to content

Commit

Permalink
Merge branch 'develop' into range_view
Browse files Browse the repository at this point in the history
  • Loading branch information
abeltrano authored Mar 1, 2023
2 parents 8f00280 + 7b93771 commit b35e46d
Show file tree
Hide file tree
Showing 20 changed files with 581 additions and 510 deletions.
17 changes: 17 additions & 0 deletions windows/drivers/uwb/simulator/IUwbSimulator.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

#ifndef I_UWB_SIMULATOR_HXX
#define I_UWB_SIMULATOR_HXX

#include <cstdint>

namespace windows::devices::uwb::simulator
{
struct IUwbSimulator
{
static constexpr uint8_t VersionMajor = 1;
static constexpr uint8_t VersionMinor = 0;
static constexpr uint32_t Version = (VersionMajor << 16U) | VersionMinor;
};
} // namespace windows::devices::uwb::simulator

#endif // I_UWB_SIMULATOR_HXX
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#ifndef UWB_SIMULATOR_DDI_CALLBACKS_LRP
#define UWB_SIMULATOR_DDI_CALLBACKS_LRP
#ifndef I_UWB_SIMULATOR_DDI_CALLBACKS_LRP
#define I_UWB_SIMULATOR_DDI_CALLBACKS_LRP

#include <cstdint>
#include <memory>
Expand All @@ -25,9 +25,9 @@ namespace windows::devices::uwb::simulator
/**
* @brief
*/
struct UwbSimulatorDdiCallbacksLrp
struct IUwbSimulatorDdiCallbacksLrp
{
virtual ~UwbSimulatorDdiCallbacksLrp() = default;
virtual ~IUwbSimulatorDdiCallbacksLrp() = default;

/**
* @brief
Expand Down Expand Up @@ -181,4 +181,4 @@ struct UwbSimulatorDdiCallbacksLrp
};
} // namespace windows::devices::uwb::simulator

#endif // UWB_SIMULATOR_DDI_CALLBACKS_LRP
#endif // I_UWB_SIMULATOR_DDI_CALLBACKS_LRP
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#ifndef UWB_SIMULATOR_DDI_CALLBACKS_SIMULATOR
#define UWB_SIMULATOR_DDI_CALLBACKS_SIMULATOR
#ifndef I_UWB_SIMULATOR_DDI_CALLBACKS_SIMULATOR
#define I_UWB_SIMULATOR_DDI_CALLBACKS_SIMULATOR

#include <windows.h>

Expand All @@ -11,17 +11,17 @@ namespace windows::devices::uwb::simulator
/**
* @brief
*/
struct UwbSimulatorDdiCallbacksSimulator
struct IUwbSimulatorDdiCallbacksSimulator
{
virtual ~UwbSimulatorDdiCallbacksSimulator() = default;
virtual ~IUwbSimulatorDdiCallbacksSimulator() = default;

/**
* @brief
*
* @return UwbStatus
*/
virtual void
GetSimulatorCapabilities(UwbSimulatorCapabilities& uwbSimulatorCapabilities) = 0;
virtual UwbSimulatorCapabilities
GetSimulatorCapabilities() = 0;

/**
* @brief
Expand All @@ -34,4 +34,4 @@ struct UwbSimulatorDdiCallbacksSimulator
};
} // namespace windows::devices::uwb::simulator

#endif // UWB_SIMULATOR_DDI_CALLBACKS_SIMULATOR
#endif // I_UWB_SIMULATOR_DDI_CALLBACKS_SIMULATOR
61 changes: 61 additions & 0 deletions windows/drivers/uwb/simulator/IUwbSimulatorDdiHandler.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

#ifndef I_UWB_SIMULATOR_DDI_HANDLER_HXX
#define I_UWB_SIMULATOR_DDI_HANDLER_HXX

#include <cstddef>
#include <span>

#include <windows.h>

#include <wdf.h>

namespace windows::devices::uwb::simulator
{
/**
* @brief Base class which responsible for handling DDI i/o control requests.
*/
struct IUwbSimulatorDdiHandler
{
virtual ~IUwbSimulatorDdiHandler() = default;

/**
* @brief Indicates whether the specified i/o control code is handled by
* this handler.
*
* @param ioControlCode The i/o control code to check.
* @return true
* @return false
*/
virtual bool
HandlesIoControlCode(ULONG ioControlCode) = 0;

/**
* @brief Validates that a given request is valid.
*
* This is responsible for validating that the input and output buffers are
* of sufficient length.
*
* @param request
* @param ioControlCode
* @param inputBufferLength
* @param outputBufferLength
* @return NTSTATUS
*/
virtual NTSTATUS
ValidateRequest(WDFREQUEST request, ULONG ioControlCode, std::size_t inputBufferLength, std::size_t outputBufferLength) = 0;

/**
* @brief Handles the request.
*
* @param request
* @param ioControlCode
* @param inputBuffer
* @param outputBuffer
* @return NTSTATUS
*/
virtual NTSTATUS
HandleRequest(WDFREQUEST request, ULONG ioControlCode, std::span<uint8_t> inputBuffer, std::span<uint8_t> outputBuffer) = 0;
};
} // namespace windows::devices::uwb::simulator

#endif // I_UWB_SIMULATOR_DDI_HANDLER_HXX
29 changes: 29 additions & 0 deletions windows/drivers/uwb/simulator/IUwbSimulatorSession.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

#ifndef I_UWB_SIMULATOR_SESSION_HXX
#define I_UWB_SIMULATOR_SESSION_HXX

#include <memory>
#include <unordered_set>
#include <vector>

#include <uwb/UwbMacAddress.hxx>
#include <uwb/protocols/fira/FiraDevice.hxx>
#include <windows/devices/uwb/UwbAppConfiguration.hxx>

namespace windows::devices::uwb::simulator
{
using ::uwb::protocol::fira::UwbSessionState;
using ::uwb::protocol::fira::UwbSessionType;

struct IUwbSimulatorSession
{
uint32_t Id;
UwbSessionType Type{ UwbSessionType::RangingSession };
UwbSessionState State{ UwbSessionState::Deinitialized };
uint32_t Sequence{ 0 };
std::unordered_set<::uwb::UwbMacAddress> Controlees;
std::vector<std::shared_ptr<IUwbAppConfigurationParameter>> ApplicationConfigurationParameters;
};
} // namespace windows::devices::uwb::simulator

#endif // I_UWB_SIMULATOR_SESSION_HXX
17 changes: 8 additions & 9 deletions windows/drivers/uwb/simulator/UwbSimulator.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,30 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="UwbSimulatorDdiCallbacksSimulatorImpl.cxx" />
<ClCompile Include="UwbSimulatorDdiHandlerLrp.cxx" />
<ClCompile Include="UwbSimulatorDdiHandlerSimulator.cxx" />
<ClCompile Include="UwbSimulatorDriver.cxx" />
<ClCompile Include="UwbSimulatorDdiCallbacksLrpNoop.cxx" />
<ClCompile Include="UwbSimulatorDdiCallbacks.cxx" />
<ClCompile Include="UwbSimulatorIoQueue.cxx" />
<ClCompile Include="UwbSimulatorDevice.cxx" />
<ClCompile Include="UwbSimulatorDeviceFile.cxx" />
<ClCompile Include="UwbSimulatorSession.cxx" />
<ClCompile Include="UwbSimulatorTracelogging.cxx" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="UwbSimulatorDdiCallbacksSimulator.hxx" />
<ClInclude Include="UwbSimulatorDdiCallbacksSimulatorImpl.hxx" />
<ClInclude Include="IUwbSimulator.hxx" />
<ClInclude Include="IUwbSimulatorDdiCallbacksSimulator.hxx" />
<ClInclude Include="IUwbSimulatorDdiHandler.hxx" />
<ClInclude Include="UwbSimulatorDdiHandler.hxx" />
<ClInclude Include="UwbSimulatorDdiHandlerLrp.hxx" />
<ClInclude Include="UwbSimulatorDdiHandlerSimulator.hxx" />
<ClInclude Include="UwbSimulatorDispatchEntry.hxx" />
<ClInclude Include="UwbSimulatorDriver.hxx" />
<ClInclude Include="include\UwbSimulatorDdi.h" />
<ClInclude Include="UwbCxLrpDevice.h" />
<ClInclude Include="UwbSimulatorDdiCallbacksLrp.hxx" />
<ClInclude Include="UwbSimulatorDdiCallbacksLrpNoop.hxx" />
<ClInclude Include="IUwbSimulatorDdiCallbacksLrp.hxx" />
<ClInclude Include="UwbSimulatorDdiCallbacks.hxx" />
<ClInclude Include="UwbSimulatorIoQueue.hxx" />
<ClInclude Include="UwbSimulatorDevice.hxx" />
<ClInclude Include="UwbSimulatorDeviceFile.hxx" />
<ClInclude Include="IUwbSimulatorSession.hxx" />
<ClInclude Include="UwbSimulatorSession.hxx" />
<ClInclude Include="UwbSimulatorTracelogging.hxx" />
</ItemGroup>
Expand Down
Loading

0 comments on commit b35e46d

Please sign in to comment.