summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdonais Romero González <[email protected]>2018-11-28 11:43:42 -0800
committerGitHub <[email protected]>2018-11-28 11:43:42 -0800
commit7695b30331c53cfd119c8ffae81b2e049341d301 (patch)
treee0e5d38b88c84b72caad4e8a849421dd803f451c
parent70876614eb9138f66399deb6a6f06e42645d9cd3 (diff)
Revert "Initial version of GNSS UMDF Sample Driver"
-rw-r--r--gnss/ReadMe.md65
-rw-r--r--gnss/gnss.yaml10
-rw-r--r--gnss/gnssUmdf.sln42
-rw-r--r--gnss/gnssUmdf/Defaults.h64
-rw-r--r--gnss/gnssUmdf/Device.cpp153
-rw-r--r--gnss/gnssUmdf/Device.h43
-rw-r--r--gnss/gnssUmdf/Driver.cpp111
-rw-r--r--gnss/gnssUmdf/Driver.h22
-rw-r--r--gnss/gnssUmdf/FixHandler.cpp168
-rw-r--r--gnss/gnssUmdf/FixHandler.h39
-rw-r--r--gnss/gnssUmdf/FixSession.cpp521
-rw-r--r--gnss/gnssUmdf/FixSession.h60
-rw-r--r--gnss/gnssUmdf/HelperUtility.cpp43
-rw-r--r--gnss/gnssUmdf/HelperUtility.h46
-rw-r--r--gnss/gnssUmdf/NmeaProcessor.cpp687
-rw-r--r--gnss/gnssUmdf/NmeaProcessor.h62
-rw-r--r--gnss/gnssUmdf/Queue.cpp439
-rw-r--r--gnss/gnssUmdf/Queue.h70
-rw-r--r--gnss/gnssUmdf/Trace.h69
-rw-r--r--gnss/gnssUmdf/gnssUmdf.infbin3542 -> 0 bytes
-rw-r--r--gnss/gnssUmdf/gnssUmdf.vcxproj177
-rw-r--r--gnss/gnssUmdf/gnssUmdf.vcxproj.filters81
-rw-r--r--gnss/gnssUmdf/precomp.h29
23 files changed, 0 insertions, 3001 deletions
diff --git a/gnss/ReadMe.md b/gnss/ReadMe.md
deleted file mode 100644
index 45a8a7ac..00000000
--- a/gnss/ReadMe.md
+++ /dev/null
@@ -1,65 +0,0 @@
-<!---
- name: GPS/GNSS UMDF Sample Driver (UMDF Version 2)
- platform: UMDF2
- language: cpp
- category: GPS/GNSS
- description: Provides base sample driver that IHVs and partners can use to extend to build their custom Windows GPS/GNSS drivers
- samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=TBD
---->
-
-
-GPS/GNSS UMDF Sample Driver (UMDF Version 2)
-==============================================================================
-
-# Overview
-
-## Goals and Requirements
-
-* Serves as base sample driver that IHVs and partners can use to extend to build their custom Windows GNSS drivers.
-* Follows the WDF guidelines and best practices around PnP device arrival/removal, power management and driver installation/uninstallation.
-* Supports the GNSS DDI mandatory requirements.
-* Well-documented and keeps it easy for partners to identify the code that needs to be updated to build their driver
-* This driver should pass HLK tests and WDF tests provided by Visual studio.
-
-## Non-goals
-
-* The sample does not support Geofence, SUPL, and AGNSS, as this is not mandatory GNSS DDI functionality.
-* Not a production driver.
-
-## Benefits
-
-* Makes it easy for IHVS to write GNSS drivers for Windows devices
-* Reduces the burden on Location dev team to support multiple IHVs writing GNSS drivers.
-
-## What Partner needs to do?
-
-* Customer can install WDK and run Location HLK tests to validate their driver. All test cases should be either pass or skip without failure. For test result of the sample driver, see Test Plan section below for detail.
-* Partner owns the following: Installing the driver. Adding certificate and driver signing. Updating manufacturer name driver version etc. (the code has comments to update).
-* For cloud-based scenario, they should update the code properly to adapter their scenario. This includes (not limited to): Do not use the NMEA parser. We disable this by default. Current Helper function of NMEA parser assumes that Serial interface as HW input source.
-Define a way to inject a position for each session. In sample, it provides a sample function for how to fill out GNSS DDI data. The GNSS sample code has TODO comments. Partner should update them accordingly.
-
-
-# Design
-
-## Flow between GNSS driver/Location service
-
-* We take WDF/UMDF 2.0 as baseline. Given that UMDF would be simpler to develop and it is enough to provide main functionality in Location. Only Windows 8.1 or beyond can run the UMDF 2.0 code.
-* GNSS driver is provided by IHV in general. Our GNSS sample driver simply offers all the minimum functionality required by the DDI, e.g., it supports a single-shot position and continuous single-shot positions.
-* LBS application built with Location API should work with the GNSS driver though Location service and WDF/UMDF 2.0. For example, 1st party apps such as Maps and Weather, and 3rd party app such as GPS Satellite works.
-* The GNSS sample driver is built on WDF. This provides the basic functionality such as PnP device removal/arrival, power/hibernate, and driver install/uninstall.
-* Test application such as HLK can run via WDF as well.
-* Location service communicates the GNSS driver through GNSS driver IOCTLs.
-
-## Design for Sample driver that gives fake location
-
-* The plan is to build a sample software only driver that demonstrates WDF & GNSS DDI mandatory requirements that can be published to GitHub. And customer then builds a version on top of that sample driver. Each fake position should be written as GNSS DDI format by customer.
-* This scenario is a baseline of this sample driver published in GitHub, even though the sample code can support another scenario below with simple modification.
-
-## Design for Sample driver that uses real HW GPS
-
-* The plan is to have GNSS driver sample that can be demonstrated to work with real GNSS device. The sample driver provides an example helper functions of using Serial port as incoming NMEA source. Hence, they can connect to USB GNSS device and see how it works between GPS device and App through Location service.
-* To switch from fake location to real HW GPS scenario, customer simply calls a different function; rather than calling a function that reads a predefined set of Latitude and Longitude data of example, it calls a function that reads GPS incoming source from Serial port. The way to switch this is documented in the code as comments.
-* The sample code provides an example of parsing NMEA messages of GPS only, i.e., US-based messages. But it is easily extensible to other types such as Beidou (China) and GLONASS (EU).
-* The sample code assumes that GNSS/GPS device is recognized as COM port (Serial interface) in Device manager via PnP automatically, where NMEA 0183 format messages come out of it. Normally, USB adapter type is used to connect the GNSS/GPS. Other types of devices such as Bluetooth can be used as long as it is recognized as a COM port.
-* Sample driver enumerates all the COM ports (0 � 255) in initialization and automatically picks up the first valid COM port.
-* If there are more than one device recognized as COM interface in Device manager, the lowest COM port will be picked. Unfortunately, the order is not configurable in Windows Location service.
diff --git a/gnss/gnss.yaml b/gnss/gnss.yaml
deleted file mode 100644
index e53b2045..00000000
--- a/gnss/gnss.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-### YamlMime:Sample
-sample:
-- name: GPS/GNSS UMDF V2 Device Driver Sample
- description: Demonstrates how to write a device driver that IHVs and partners can use to extend to build their custom drivers
- generateZip: true
- author: windows-driver-samples
- languages:
- - cpp
- technologies:
- - windows
diff --git a/gnss/gnssUmdf.sln b/gnss/gnssUmdf.sln
deleted file mode 100644
index 11ab7b8e..00000000
--- a/gnss/gnssUmdf.sln
+++ /dev/null
@@ -1,42 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.27703.2042
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gnssUmdf", "gnssUmdf\gnssUmdf.vcxproj", "{AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{79D3FD2A-EEAE-4C86-90AF-39B7FFD6D27D}"
- ProjectSection(SolutionItems) = preProject
- gps.yaml = gps.yaml
- ReadMe.md = ReadMe.md
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Debug|x64.ActiveCfg = Debug|x64
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Debug|x64.Build.0 = Debug|x64
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Debug|x64.Deploy.0 = Debug|x64
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Debug|x86.ActiveCfg = Debug|Win32
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Debug|x86.Build.0 = Debug|Win32
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Debug|x86.Deploy.0 = Debug|Win32
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Release|x64.ActiveCfg = Release|x64
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Release|x64.Build.0 = Release|x64
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Release|x64.Deploy.0 = Release|x64
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Release|x86.ActiveCfg = Release|Win32
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Release|x86.Build.0 = Release|Win32
- {AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}.Release|x86.Deploy.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {C0D84930-F293-4CFC-ACFB-2A71C4CADDFD}
- SolutionGuid = {E7531486-DB0B-43B1-AC4A-AFDE26BDED47}
- EndGlobalSection
-EndGlobal
diff --git a/gnss/gnssUmdf/Defaults.h b/gnss/gnssUmdf/Defaults.h
deleted file mode 100644
index 21c0404b..00000000
--- a/gnss/gnssUmdf/Defaults.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- defaults.h
-
-Abstract:
-
- This module contains the defaults used within the Umdf Gnss Driver.
-
-Environment:
-
- driver and application
-
---*/
-
-#pragma once
-
-#define GNSS_DRIVER_DDK_VERSION GNSS_DRIVER_VERSION_4
-#define INVALID_SESSION_ID (0xFFFFFFFF)
-#define DEFAULT_FIX_INTERVAL_SECONDS 1 // 1 sec
-
-static const double c_MaximumLatitude = 90.0;
-static const double c_MinimumLatitude = -90.0;
-static const double c_MaximumLongitude = 180.0;
-static const double c_MinimumLongitude = -180.0;
-
-const GNSS_FIXDATA g_DefaultGnssFixData =
-{
- sizeof(GNSS_FIXDATA),
- GNSS_DRIVER_DDK_VERSION,
- INVALID_SESSION_ID,
- { 0x299a64f0, 0x01d3120f }, // an example date, 8/10/2017
- TRUE,
- STATUS_SUCCESS,
- GNSS_FIXDETAIL_BASIC | GNSS_FIXDETAIL_ACCURACY | GNSS_FIXDETAIL_SATELLITE,
- {
- sizeof(GNSS_FIXDATA_BASIC),
- GNSS_DRIVER_DDK_VERSION,
- 45.519653, // an example location, Portland OR, USA
- -122.667703,
- 0.0,
- 0.0,
- 0.0
- },
- {
- sizeof(GNSS_FIXDATA_ACCURACY),
- GNSS_DRIVER_DDK_VERSION,
- 10 // Meters accuracy
- },
- {
- sizeof(GNSS_FIXDATA_SATELLITE),
- GNSS_DRIVER_DDK_VERSION,
- 4, // satellite count
- {
- { 1, TRUE, 0, 0, 10 },
- { 2, FALSE, 0, 0, 20 },
- { 3, FALSE, 0, 0, 30 },
- { 4, FALSE, 0, 0, 40 },
- }
- }
-};
diff --git a/gnss/gnssUmdf/Device.cpp b/gnss/gnssUmdf/Device.cpp
deleted file mode 100644
index ed642981..00000000
--- a/gnss/gnssUmdf/Device.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- device.c
-
-Abstract:
-
- This file contains the device entry points and callbacks.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#include "precomp.h"
-#include "Trace.h"
-#include "Defaults.h"
-#include "Device.h"
-#include "NmeaProcessor.h"
-#include "FixSession.h"
-#include "FixHandler.h"
-#include "Queue.h"
-
-#include "Device.tmh"
-
-
-CDevice::CDevice(
- _In_ WDFDEVICE Device
-) :
- _Device(Device),
- _Queue(nullptr)
-{
-}
-
-CDevice::~CDevice()
-{
- if (_Queue != nullptr)
- {
- _Queue = nullptr;
- }
-}
-
-CQueue*
-CDevice::GetQueue()
-{
- return _Queue;
-}
-
-NTSTATUS
-CDevice::OnDeviceAdd(
- _In_ WDFDRIVER /*Driver*/,
- _Inout_ PWDFDEVICE_INIT DeviceInit
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- WDF_PNPPOWER_EVENT_CALLBACKS powerCallbacks;
- WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&powerCallbacks);
-
- powerCallbacks.EvtDeviceD0Entry = CDevice::OnD0Entry;
- powerCallbacks.EvtDeviceD0Exit = CDevice::OnD0Exit;
-
- WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &powerCallbacks);
-
- WDF_OBJECT_ATTRIBUTES deviceAttributes;
- WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes,
- CDevice);
-
- deviceAttributes.EvtCleanupCallback = CDevice::OnCleanup;
- deviceAttributes.SynchronizationScope = WdfSynchronizationScopeNone;
- deviceAttributes.ExecutionLevel = WdfExecutionLevelPassive;
-
- WDFDEVICE device;
- status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device);
-
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DEVICE, "WdfDeviceCreate failed with Status %!STATUS!", status);
- goto Exit;
- }
-
- // Construct device object on the preallocated buffer using placement 'new'
- CDevice* pDevice = new (GetDeviceObject(device)) CDevice(device);
-
- status = pDevice->Initialize();
-
-Exit:
- return status;
-}
-
-NTSTATUS
-CDevice::Initialize()
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- status = CQueue::AddQueueToDevice(_Device, &_Queue);
-
- // Register FakeGnss Device interface
- // Note: we are not publishing a symbolic link.
- status = WdfDeviceCreateDeviceInterface(_Device,
- (LPGUID)&GUID_DEVINTERFACE_GNSS,
- nullptr);
-
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DEVICE, "WdfDeviceCreateDeviceInterface failed with %!STATUS!", status);
- goto Exit;
- }
-
-Exit:
- return status;
-}
-
-void
-CDevice::OnCleanup(
- _In_ WDFOBJECT Object
-)
-{
- CDevice *pDevice = GetDeviceObject(Object);
-
- // Device object constructed using placement 'new' so explicitly invoke destructor
- pDevice->~CDevice();
-}
-
-NTSTATUS
-CDevice::OnD0Entry(
- _In_ WDFDEVICE /*Device*/,
- _In_ WDF_POWER_DEVICE_STATE /*PreviousState*/
-)
-{
- NTSTATUS status;
-
- status = STATUS_SUCCESS;
-
- return status;
-}
-
-NTSTATUS
-CDevice::OnD0Exit(
- _In_ WDFDEVICE /*Device*/,
- _In_ WDF_POWER_DEVICE_STATE /*TargetState*/
-)
-{
- NTSTATUS status;
-
- status = STATUS_SUCCESS;
-
- return status;
-}
diff --git a/gnss/gnssUmdf/Device.h b/gnss/gnssUmdf/Device.h
deleted file mode 100644
index d73c7deb..00000000
--- a/gnss/gnssUmdf/Device.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- device.h
-
-Abstract:
-
- This file contains the device definitions.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#pragma once
-
-class CQueue;
-
-class CDevice
-{
-public:
- static EVT_WDF_DRIVER_DEVICE_ADD OnDeviceAdd;
-
-private:
- CDevice(_In_ WDFDEVICE Device);
- ~CDevice();
-
- static EVT_WDF_OBJECT_CONTEXT_CLEANUP OnCleanup;
- static EVT_WDF_DEVICE_D0_ENTRY OnD0Entry;
- static EVT_WDF_DEVICE_D0_EXIT OnD0Exit;
-
- NTSTATUS Initialize();
- CQueue* GetQueue();
-
- WDFDEVICE _Device = nullptr;
- CQueue* _Queue = nullptr;
-};
-
-WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CDevice, GetDeviceObject);
diff --git a/gnss/gnssUmdf/Driver.cpp b/gnss/gnssUmdf/Driver.cpp
deleted file mode 100644
index 6e4a2289..00000000
--- a/gnss/gnssUmdf/Driver.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- driver.cpp
-
-Abstract:
-
- This file contains the driver entry points and callbacks.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#include "precomp.h"
-#include "Trace.h"
-#include "Defaults.h"
-#include "Driver.h"
-#include "Device.h"
-#include "NmeaProcessor.h"
-#include "FixSession.h"
-#include "FixHandler.h"
-#include "Queue.h"
-
-#include "Driver.tmh"
-
-
-extern "C"
-NTSTATUS
-DriverEntry(
- _In_ PDRIVER_OBJECT DriverObject,
- _In_ PUNICODE_STRING RegistryPath
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- // Initialize WPP Tracing
- WPP_INIT_TRACING(DriverObject, RegistryPath);
-
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Entry");
-
- // Register a cleanup callback so that we can call WPP_CLEANUP when
- // the framework driver object is deleted during driver unload.
- WDF_OBJECT_ATTRIBUTES attributes;
- WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
- attributes.EvtCleanupCallback = GnssUmdfEvtDriverContextCleanup;
-
- WDF_DRIVER_CONFIG config;
- WDF_DRIVER_CONFIG_INIT(&config,
- CDevice::OnDeviceAdd);
-
- config.EvtDriverUnload = OnDriverUnload;
-
- status = WdfDriverCreate(DriverObject,
- RegistryPath,
- &attributes,
- &config,
- WDF_NO_HANDLE);
-
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_DRIVER, "WdfDriverCreate failed %!STATUS!", status);
-
- WPP_CLEANUP(DriverObject);
-
- return status;
- }
-
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Exit");
-
- return status;
-}
-
-void
-GnssUmdfEvtDriverContextCleanup(
- _In_ WDFOBJECT DriverObject
-)
-/*++
-Routine Description:
-
- Free all the resources allocated in DriverEntry.
-
-Arguments:
-
- DriverObject - handle to a WDF Driver object.
-
-Return Value:
-
- void.
-
---*/
-{
- UNREFERENCED_PARAMETER(DriverObject);
-
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Entry");
-
- // Stop WPP Tracing
- WPP_CLEANUP(WdfDriverWdmGetDriverObject((WDFDRIVER)DriverObject));
-}
-
-void
-OnDriverUnload(
- _In_ WDFDRIVER /* Driver */
-)
-{
- WPP_CLEANUP(Driver);
-}
diff --git a/gnss/gnssUmdf/Driver.h b/gnss/gnssUmdf/Driver.h
deleted file mode 100644
index 5de6d35e..00000000
--- a/gnss/gnssUmdf/Driver.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- driver.h
-
-Abstract:
-
- This file contains the driver definitions.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#pragma once
-
-EVT_WDF_DRIVER_UNLOAD OnDriverUnload;
-EVT_WDF_OBJECT_CONTEXT_CLEANUP GnssUmdfEvtDriverContextCleanup;
diff --git a/gnss/gnssUmdf/FixHandler.cpp b/gnss/gnssUmdf/FixHandler.cpp
deleted file mode 100644
index 0336dc89..00000000
--- a/gnss/gnssUmdf/FixHandler.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- fixhandler.cpp
-
-Abstract:
-
- This file contains the Fix handler and contains logic to provide position.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#include "precomp.h"
-#include "Trace.h"
-#include "Defaults.h"
-#include "NmeaProcessor.h"
-#include "FixSession.h"
-#include "FixHandler.h"
-
-#include "FixHandler.tmh"
-
-
-NTSTATUS
-CFixHandler::Initialize(
- _In_ WDFQUEUE Queue
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- status = _SingleShotSession.Initialize(Queue);
-
- return status;
-}
-
-NTSTATUS
-CFixHandler::StartFix(
- _In_ WDFREQUEST Request
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
- PGNSS_FIXSESSION_PARAM fixSessionParameters = nullptr;
-
- status = WdfRequestRetrieveInputBuffer(Request, sizeof(GNSS_FIXSESSION_PARAM), (void**)&fixSessionParameters, nullptr);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "WdfRequestRetrieveInputBuffer failed with %!STATUS!", status);
- goto Exit;
- }
-
- if (fixSessionParameters->SessionType != GNSS_FixSession_SingleShot)
- {
- status = STATUS_UNSUCCESSFUL;
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "Session type is not GNSS_FixSession_SingleShot");
- goto Exit;
- }
-
- _CurrentSinglsShotSessionId = fixSessionParameters->FixSessionID;
-
- status = _SingleShotSession.StartAcquiringFix(fixSessionParameters);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "StartFix failed with %!STATUS!", status);
- goto Exit;
- }
-
-Exit:
- return status;
-}
-
-NTSTATUS
-CFixHandler::StopFix(
- _In_ WDFREQUEST Request
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
- PGNSS_STOPFIXSESSION_PARAM StopFixSessionParam = nullptr;
-
- status = WdfRequestRetrieveInputBuffer(Request, sizeof(GNSS_STOPFIXSESSION_PARAM), (void**)&StopFixSessionParam, nullptr);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "WdfRequestRetrieveInputBuffer failed with %!STATUS!", status);
- goto Exit;
- }
-
- // Send the session parameters to the right session based on the ID
- if (StopFixSessionParam->FixSessionID != _CurrentSinglsShotSessionId)
- {
- status = STATUS_UNSUCCESSFUL;
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "Session type is not GNSS_FixSession_SingleShot");
- goto Exit;
- }
-
- _CurrentSinglsShotSessionId = INVALID_SESSION_ID;
-
- status = _SingleShotSession.StopAcquiringFix(StopFixSessionParam);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "StopFix failed with %!STATUS!", status);
- goto Exit;
- }
-
-Exit:
- return status;
-}
-
-NTSTATUS
-CFixHandler::ModifyFix(
- _In_ WDFREQUEST /*Request*/
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- //
- // TODO: Currently not doing anything yet
- //
-
- return status;
-}
-
-NTSTATUS
-CFixHandler::GetFixRequest(
- _In_ WDFREQUEST Request
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
- ULONG sessionId = INVALID_SESSION_ID;
- ULONG *pSessionId = nullptr;
-
- // Get the session ID this get fix is for
- status = WdfRequestRetrieveInputBuffer(Request, sizeof(sessionId), (void**)&pSessionId, nullptr);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "Could not retrieve input sessionID for request");
- goto Exit;
- }
-
- // Should do this check at the FixHandler Level.
- sessionId = *pSessionId;
-
- status = _SingleShotSession.GetFix(Request);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "SinglShotSession.GetFix failed with %!STATUS!", status);
- goto Exit;
- }
-
-Exit:
- return status;
-}
-
-NTSTATUS
-CFixHandler::SetCurrentPosition(
- _In_ PGNSS_FIXDATA GnssFixData
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- // Update the current sessions.
- status = _SingleShotSession.UpdateCurrentPosition(GnssFixData);
-
- return status;
-}
diff --git a/gnss/gnssUmdf/FixHandler.h b/gnss/gnssUmdf/FixHandler.h
deleted file mode 100644
index 21d9f2d2..00000000
--- a/gnss/gnssUmdf/FixHandler.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- Fixhandler.h
-
-Abstract:
-
- This module contains the type definitions of the fix logic of the Umdf Gnss Driver.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#pragma once
-
-class CFixSession;
-
-class CFixHandler
-{
-public:
- NTSTATUS Initialize(_In_ WDFQUEUE Queue);
-
- NTSTATUS StartFix(_In_ WDFREQUEST Request);
- NTSTATUS StopFix(_In_ WDFREQUEST Request);
- NTSTATUS GetFixRequest(_In_ WDFREQUEST Request);
- NTSTATUS ModifyFix(_In_ WDFREQUEST Request);
-
- NTSTATUS SetCurrentPosition(_In_ PGNSS_FIXDATA GnssFixData);
-
-private:
- // Session objects
- CFixSession _SingleShotSession;
- ULONG _CurrentSinglsShotSessionId = INVALID_SESSION_ID;
-};
diff --git a/gnss/gnssUmdf/FixSession.cpp b/gnss/gnssUmdf/FixSession.cpp
deleted file mode 100644
index fa9b505f..00000000
--- a/gnss/gnssUmdf/FixSession.cpp
+++ /dev/null
@@ -1,521 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- fixsession.cpp
-
-Abstract:
-
- This file contains the Fix sessions and contains logic to provide position.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#include "precomp.h"
-#include "Trace.h"
-#include "Defaults.h"
-#include "HelperUtility.h"
-#include "NmeaProcessor.h"
-#include "FixSession.h"
-#include "FixHandler.h"
-
-#include "FixSession.tmh"
-
-
-static void CALLBACK
-s_FixThreadStub(
- _Inout_ PTP_CALLBACK_INSTANCE Instance,
- _Inout_opt_ PVOID Context,
- _Inout_ PTP_WORK Work
-);
-
-CFixSession::CFixSession() :
- _Id(INVALID_SESSION_ID),
- _State(STOPPED),
- _HasCachedFix(false),
- _StopFixEvent(nullptr),
- _ThreadpoolWork(nullptr)
-{
- InitializeCriticalSection(&_Lock);
- _GnssPosition = g_DefaultGnssFixData;
-}
-
-CFixSession::~CFixSession()
-{
- if (_StopFixEvent != nullptr && _ThreadpoolWork != nullptr)
- {
- SetEvent(_StopFixEvent);
- WaitForThreadpoolWorkCallbacks(_ThreadpoolWork, TRUE);
- }
-
- if (_StopFixEvent != nullptr)
- {
- CloseHandle(_StopFixEvent);
- _StopFixEvent = nullptr;
- }
-
- if (_ThreadpoolWork != nullptr)
- {
- CloseThreadpoolWork(_ThreadpoolWork);
- _ThreadpoolWork = nullptr;
- }
-
- DeleteCriticalSection(&_Lock);
-}
-
-NTSTATUS
-CFixSession::Initialize(
- _In_ WDFQUEUE Queue
-)
-{
- EnterCriticalSection(&_Lock);
-
- NTSTATUS status = STATUS_SUCCESS;
-
- // set the state
- _State = STOPPED;
-
- // Create the TP work
- _ThreadpoolWork = CreateThreadpoolWork(
- (PTP_WORK_CALLBACK)s_FixThreadStub,
- (PVOID)this,
- nullptr
- );
-
- if (_ThreadpoolWork == nullptr)
- {
- status = STATUS_UNSUCCESSFUL;
- goto Exit;
- }
-
- // Create the stop fix Event
-
- _StopFixEvent = CreateEvent(/* lpEventAttributes */ nullptr, /* bManualReset */ FALSE, /* bInitialState */ FALSE, /* lpName */ nullptr);
- if (_StopFixEvent == nullptr)
- {
- status = STATUS_UNSUCCESSFUL;
- goto Exit;
- }
-
- // Create the manual dispatch queue
- WDF_IO_QUEUE_CONFIG queueConfiguration;
- WDF_IO_QUEUE_CONFIG_INIT(&queueConfiguration, WdfIoQueueDispatchManual);
-
- // Initialize the attributes of the queue. Set the execution level to
- // passive to force all IRPs to be sent to the driver at passive IRQL.
- WDF_OBJECT_ATTRIBUTES ioQueueAttributes;
- WDF_OBJECT_ATTRIBUTES_INIT(&ioQueueAttributes);
- ioQueueAttributes.SynchronizationScope = WdfSynchronizationScopeQueue;
- ioQueueAttributes.ExecutionLevel = WdfExecutionLevelPassive;
- status = WdfIoQueueCreate(WdfIoQueueGetDevice(Queue),
- &queueConfiguration,
- &ioQueueAttributes,
- &_FixAcquisitionRequestQueue);
-
-Exit:
- LeaveCriticalSection(&_Lock);
- return status;
-}
-
-NTSTATUS
-CFixSession::StartAcquiringFix(
- _In_ PGNSS_FIXSESSION_PARAM FixSessionParameters
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- EnterCriticalSection(&_Lock);
-
- // Check the state of the thread.
- // If already running we should not get this request
- // as multiplexing is not supported for Singleshot
- if (_State == ACQUIRING)
- {
- status = STATUS_UNSUCCESSFUL;
- goto Exit;
- }
-
- // Create PTP_WORK only when first start fix is called.
- if (_ThreadpoolWork == nullptr)
- {
- // Not initialized. Error out
- status = STATUS_UNSUCCESSFUL;
- goto Exit;
- }
-
- _Id = FixSessionParameters->FixSessionID;
- _State = ACQUIRING;
- _FixParameter = *FixSessionParameters;
-
- ResetEvent(_StopFixEvent);
-
- // Post a work object to the thread
- SubmitThreadpoolWork(_ThreadpoolWork);
-
- // Initialize the GetFix Queue
- WdfIoQueueStart(_FixAcquisitionRequestQueue);
-
-Exit:
- LeaveCriticalSection(&_Lock);
-
- return status;
-}
-
-NTSTATUS
-CFixSession::StopAcquiringFix(
- _In_ PGNSS_STOPFIXSESSION_PARAM StopFixSessionParam
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- {
- EnterCriticalSection(&_Lock);
-
- // If Ids don't Match return Error
- if (StopFixSessionParam->FixSessionID != _Id)
- {
- status = STATUS_UNSUCCESSFUL;
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FIX, "Id mismatch in Stop Fix Session call");
- goto Exit;
- }
-
- // Check the state of the session
- if (_State != ACQUIRING)
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FIX, "Can't stop an inactive session.");
- goto Exit;
- }
-
- // Stop the current processing of the fix session
- if (_StopFixEvent != nullptr)
- {
- SetEvent(_StopFixEvent);
- }
-
- LeaveCriticalSection(&_Lock);
- }
- // Wait for any threadpool work to finish.
- if (_ThreadpoolWork != nullptr)
- {
- WaitForThreadpoolWorkCallbacks(_ThreadpoolWork, TRUE);
- }
-
- EnterCriticalSection(&_Lock);
- _State = STOPPED;
-
- // Drain the GetFix Queue
- WdfIoQueuePurgeSynchronously(_FixAcquisitionRequestQueue);
-
-Exit:
- LeaveCriticalSection(&_Lock);
-
- return status;
-}
-
-NTSTATUS
-CFixSession::ReportGnssFix(
- _In_ PGNSS_FIXDATA GnssFix
-)
-{
- EnterCriticalSection(&_Lock);
-
- NTSTATUS status = STATUS_SUCCESS;
- WDFREQUEST Request;
- WDF_IO_QUEUE_STATE QueueStatus;
- ULONG uRequest;
-
- QueueStatus = WdfIoQueueGetState(_FixAcquisitionRequestQueue, &uRequest, nullptr);
- if (!WDF_IO_QUEUE_READY(QueueStatus) || (uRequest == 0))
- {
- status = STATUS_UNSUCCESSFUL;
- goto Exit;
- }
-
- if (STATUS_SUCCESS == WdfIoQueueRetrieveNextRequest(_FixAcquisitionRequestQueue, &Request))
- {
- status = CompleteRequestWithGnssFix(Request, GnssFix);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "Could not respond with fix data with %!STATUS!", status);
- goto Exit;
- }
- }
- else
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "Couldn't retrieve the next request with %!STATUS!", status);
- goto Exit;
- }
-
-Exit:
- LeaveCriticalSection(&_Lock);
-
- return status;
-}
-
-NTSTATUS
-CFixSession::CompleteRequestWithGnssFix(
- _In_ WDFREQUEST Request,
- PGNSS_FIXDATA GnssFix
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
- PVOID outputBuffer;
- size_t outputBufferLength;
- PGNSS_EVENT gnssEvent;
- size_t size = FIELD_OFFSET(GNSS_EVENT, FixData) + sizeof(GNSS_FIXDATA);
-
- status = WdfRequestRetrieveOutputBuffer(Request,
- size,
- &outputBuffer,
- &outputBufferLength);
-
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "WdfRequestRetrieveOutputBuffer() failed with %!STATUS!", status);
- goto Exit;
- }
-
- gnssEvent = ((GNSS_EVENT *)outputBuffer);
- memset(outputBuffer, 0, size);
- gnssEvent->Version = GNSS_DRIVER_VERSION_2;
- gnssEvent->EventType = GNSS_Event_FixAvailable;
- gnssEvent->EventDataSize = sizeof(GNSS_FIXDATA);
- gnssEvent->Size = (ULONG)size;
- memcpy_s(&gnssEvent->FixData, sizeof(GNSS_FIXDATA), GnssFix, sizeof(GNSS_FIXDATA));
- gnssEvent->FixData.FixSessionID = _Id;
-
- WdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, outputBufferLength);
- status = STATUS_PENDING;
-Exit:
- return status;
-}
-
-NTSTATUS
-CFixSession::UpdateCurrentPosition(
- _In_ PGNSS_FIXDATA GnssFix
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- EnterCriticalSection(&_Lock);
-
- memcpy_s(&_GnssPosition, sizeof(GNSS_FIXDATA), GnssFix, sizeof(*GnssFix));
-
- LeaveCriticalSection(&_Lock);
-
- return status;
-}
-
-NTSTATUS
-CFixSession::GetFix(
- _In_ WDFREQUEST Request
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
- ULONG sessionId = INVALID_SESSION_ID;
- PGNSS_EVENT outputEvent = nullptr;
- ULONG *pSessionId = nullptr;
-
- EnterCriticalSection(&_Lock);
-
- // Verify the size of where output goes eventually, when this IRP is serviced
- status = WdfRequestRetrieveOutputBuffer(Request, sizeof(GNSS_EVENT), (void**)&outputEvent, nullptr);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FIX, "Could not retrieve output buffer for request with %!STATUS!", status);
- goto Exit;
- }
-
- // Get the session ID this get fix is for
- status = WdfRequestRetrieveInputBuffer(Request, sizeof(sessionId), (void**)&pSessionId, nullptr);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FIX, "Could not retrieve input sessionID for request");
- goto Exit;
- }
-
- sessionId = *pSessionId;
-
- // Check if the Ids match
- if (_Id != sessionId)
- {
- status = STATUS_UNSUCCESSFUL;
- goto Exit;
- }
- // If we have a cached fix around because we tried to respond while there
- // weren't any getfixes around, answer immediately with it
- if (_HasCachedFix)
- {
- status = CompleteRequestWithGnssFix(Request, &_GnssPosition);
-
- _HasCachedFix = !(NT_SUCCESS(status));
- }
- // Otherwise, we push the request into a queue
- else
- {
- status = WdfRequestForwardToIoQueue(Request, _FixAcquisitionRequestQueue);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FIX, "WdfRequestForwardToIoQueue failed with %!STATUS!", status);
- goto Exit;
- }
-
- status = STATUS_PENDING;
- }
-
-Exit:
- LeaveCriticalSection(&_Lock);
-
- return status;
-}
-
-static void CALLBACK
-s_FixThreadStub(
- _Inout_ PTP_CALLBACK_INSTANCE /*Instance*/,
- _Inout_opt_ PVOID Context,
- _Inout_ PTP_WORK /*Work*/
-)
-{
- CFixSession *pFixSession = static_cast<CFixSession *>(Context);
-
- pFixSession->AcquireSingleFix();
-}
-
-void
-CFixSession::AcquireSingleFix()
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- while (true)
- {
- // Wait stop fix event for 1 second and then retrieve position
- DWORD WaitCode = WaitForSingleObject(_StopFixEvent, DEFAULT_FIX_INTERVAL_SECONDS * 1000);
- if (WaitCode == WAIT_TIMEOUT)
- {
- status = RetrievePosition(&_GnssPosition);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FIX, "Fail to retrieve fix data from position source");
- }
-
- // Send the default fix to the session
- status = ReportGnssFix(&_GnssPosition);
- if (!NT_SUCCESS(status))
- {
- // We were not able to send the fix so cache it
- _HasCachedFix = true;
- }
- else
- {
- if (_GnssPosition.IsFinalFix != FALSE)
- {
- break;
- }
- }
- }
- else if (WaitCode == WAIT_OBJECT_0)
- {
- // Stop session signalled
- break;
- }
- }
-
- EnterCriticalSection(&_Lock);
-
- // Reset the StopFix Event if it is set
- ResetEvent(_StopFixEvent);
-
- // Update the state of the session
- _State = STOPPED;
-
- LeaveCriticalSection(&_Lock);
-}
-
-
-NTSTATUS
-CFixSession::RetrievePosition(
- _In_ PGNSS_FIXDATA GnssFixData
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- //
- // TODO: You can retrieve a real position from GPS HW or a fake position from internal memory
- // Call either RetrievePositionWithoutGPSDevice or RetrievePositionWithGPSDevice accordingly
- //
- status = RetrievePositionWithoutGPSDevice(GnssFixData);
-
- return status;
-}
-
-NTSTATUS
-CFixSession::RetrievePositionWithoutGPSDevice(
- _Out_ PGNSS_FIXDATA GnssFixData
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- //
- // TODO: You can specify a fake GNSS_FIXDATA output based off the DDI format.
- // The following is an example.
- //
- *GnssFixData =
- {
- sizeof(GNSS_FIXDATA),
- GNSS_DRIVER_DDK_VERSION,
- INVALID_SESSION_ID,
- { 0x299a64f0, 0x01d3120f }, // an example date, 8/10/2017
- TRUE,
- STATUS_SUCCESS,
- GNSS_FIXDETAIL_BASIC | GNSS_FIXDETAIL_ACCURACY | GNSS_FIXDETAIL_SATELLITE,
- {
- sizeof(GNSS_FIXDATA_BASIC),
- GNSS_DRIVER_DDK_VERSION,
- 45.519653, // an example location, Portland OR, USA
- -122.667703,
- 0.0,
- 0.0,
- 0.0
- },
- {
- sizeof(GNSS_FIXDATA_ACCURACY),
- GNSS_DRIVER_DDK_VERSION,
- 10 // Meters accuracy
- },
- {
- sizeof(GNSS_FIXDATA_SATELLITE),
- GNSS_DRIVER_DDK_VERSION,
- 4, // satellite count
- {
- { 1, TRUE, 0, 0, 10 },
- { 2, FALSE, 0, 0, 20 },
- { 3, FALSE, 0, 0, 30 },
- { 4, FALSE, 0, 0, 40 },
- }
- }
- };
- return status;
-}
-
-NTSTATUS
-CFixSession::RetrievePositionWithGPSDevice(
- _In_ PGNSS_FIXDATA GnssFixData
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- // Read and parse NMEA messages from GPS device
- status = NmeaProcessor.ReadNextNmeaSentence(GnssFixData);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_FIX, "ReadNextNmeaSentence failed with %!STATUS!", status);
- return status;
- }
-
- return status;
-}
diff --git a/gnss/gnssUmdf/FixSession.h b/gnss/gnssUmdf/FixSession.h
deleted file mode 100644
index e61e8dba..00000000
--- a/gnss/gnssUmdf/FixSession.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- Fixsession.h
-
-Abstract:
-
- This module contains the type definitions of the fix logic of the Umdf Gnss Driver.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#pragma once
-
-class CNmeaProcessor;
-
-class CFixSession
-{
-public:
- CFixSession();
- ~CFixSession();
-
- void AcquireSingleFix();
- NTSTATUS Initialize(_In_ WDFQUEUE Queue);
- NTSTATUS StartAcquiringFix(_In_ PGNSS_FIXSESSION_PARAM FixSessionParameters);
- NTSTATUS StopAcquiringFix(_In_ PGNSS_STOPFIXSESSION_PARAM StopFixSessionParam);
- NTSTATUS GetFix(_In_ WDFREQUEST Request);
- NTSTATUS UpdateCurrentPosition(_In_ PGNSS_FIXDATA GnssFix);
-
- NTSTATUS RetrievePosition(_In_ PGNSS_FIXDATA GnssFixData);
- NTSTATUS RetrievePositionWithoutGPSDevice(_Out_ PGNSS_FIXDATA GnssFixData);
- NTSTATUS RetrievePositionWithGPSDevice(_In_ PGNSS_FIXDATA GnssFixData);
-
-private:
- enum STATE
- {
- ACQUIRING = 0,
- STOPPED
- };
-
- ULONG _Id = INVALID_SESSION_ID;
- STATE _State = STOPPED;
- GNSS_FIXSESSION_PARAM _FixParameter = {};
- WDFQUEUE _FixAcquisitionRequestQueue = nullptr;
- bool _HasCachedFix = false;
- GNSS_FIXDATA _GnssPosition = {};
- HANDLE _StopFixEvent = nullptr;
- PTP_WORK _ThreadpoolWork = nullptr;
- CRITICAL_SECTION _Lock;
- CNmeaProcessor NmeaProcessor;
-
- NTSTATUS CompleteRequestWithGnssFix(_In_ WDFREQUEST Request, PGNSS_FIXDATA GnssFix);
- NTSTATUS ReportGnssFix(_In_ PGNSS_FIXDATA GnssFix);
-};
diff --git a/gnss/gnssUmdf/HelperUtility.cpp b/gnss/gnssUmdf/HelperUtility.cpp
deleted file mode 100644
index 28f78c1f..00000000
--- a/gnss/gnssUmdf/HelperUtility.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- HelperUtility.cpp
-
-Abstract:
-
- This file contains the helper functions.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#include "precomp.h"
-#include "Trace.h"
-#include "HelperUtility.h"
-
-#include "HelperUtility.tmh"
-
-
-_Use_decl_annotations_
-BOOL
-HelperUtility::GetDataFromCommand(
- _In_ PGNSS_DRIVERCOMMAND_PARAM Command,
- _In_ size_t DataLen,
- _Out_ void* Data
-)
-{
- ZeroMemory(Data, DataLen);
-
- if (!Command || (Command->CommandDataSize != DataLen))
- {
- return FALSE;
- }
-
- memcpy_s(Data, DataLen, Command->CommandData, DataLen);
- return TRUE;
-}
diff --git a/gnss/gnssUmdf/HelperUtility.h b/gnss/gnssUmdf/HelperUtility.h
deleted file mode 100644
index 1414cb06..00000000
--- a/gnss/gnssUmdf/HelperUtility.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- HelperUtility.h
-
-Abstract:
-
- This module contains the Helper class used by other classes within the Umdf Gnss Driver.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#pragma once
-
-class HelperUtility
-{
-public:
- static BOOL GetDataFromCommand(_In_ PGNSS_DRIVERCOMMAND_PARAM Command,
- _In_ size_t DataLen,
- _Out_ void* Data);
-};
-
-template <class DataT>
-BOOL GetDataFromCommand(
- _In_ PGNSS_DRIVERCOMMAND_PARAM Command,
- _Inout_ DataT* Data)
-{
- return HelperUtility::GetDataFromCommand(Command, sizeof(*Data), Data);
-}
-
-template <class DataT>
-void INIT_POD_GNSS_STRUCT(
- _Out_ DataT* Data
-)
-{
- RtlZeroMemory(Data, sizeof(*Data));
-
- Data->Size = sizeof(*Data);
- Data->Version = GNSS_DRIVER_DDK_VERSION;
-}
diff --git a/gnss/gnssUmdf/NmeaProcessor.cpp b/gnss/gnssUmdf/NmeaProcessor.cpp
deleted file mode 100644
index 97707a43..00000000
--- a/gnss/gnssUmdf/NmeaProcessor.cpp
+++ /dev/null
@@ -1,687 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- NmeaProcessor.cpp
-
-Abstract:
-
- This file contains the NMEA parser.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
-Revision History:
-
---*/
-
-#include "precomp.h"
-#include "Trace.h"
-#include "Defaults.h"
-#include "HelperUtility.h"
-#include "NmeaProcessor.h"
-#include "FixSession.h"
-#include "FixHandler.h"
-
-#include <cfgmgr32.h>
-
-#include "NmeaProcessor.tmh"
-
-
-CNmeaProcessor::CNmeaProcessor() :
- _HandleComm(INVALID_HANDLE_VALUE)
-{
- InitializeCriticalSection(&_Lock);
-
- memset(_NmeaMessageBuf, 0, sizeof(_NmeaMessageBuf));
-}
-
-CNmeaProcessor::~CNmeaProcessor()
-{
- CloseHandler(_HandleComm);
-
- DeleteCriticalSection(&_Lock);
-}
-
-bool
-CNmeaProcessor::SetCommHandleForSerial()
-{
- std::wstring portNumCandidate;
- bool foundPort = false;
- HRESULT hr = S_OK;
- DWORD bytesWritten = 0;
- ULONG interfaceListSize = 0;
-
- // Get the size of the buffer necessary for the list of volumes
- CONFIGRET cr = CM_Get_Device_Interface_List_Size(&interfaceListSize,
- (LPGUID)&GUID_DEVINTERFACE_COMPORT,
- nullptr,
- CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
- // size 1 is for null terminator
- if (cr != CR_SUCCESS || interfaceListSize <= 1)
- {
- // No existing device interface has been created.
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_NMEA, "CM_Get_Device_Interface_List_Size failed with %x", cr);
- return false;
- }
-
- // Found at least one existing device interface.
- std::unique_ptr<WCHAR[]> interfaceList(new WCHAR[interfaceListSize]);
- cr = CM_Get_Device_Interface_List((LPGUID)&GUID_DEVINTERFACE_COMPORT,
- nullptr,
- interfaceList.get(),
- interfaceListSize,
- CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
- if (cr != CR_SUCCESS)
- {
- // No existing device interface has been created.
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_NMEA, "CM_Get_Device_Interface_List failed with %x", cr);
- return false;
- }
-
- // Loop through all devices with this COMPORT interface. This is a double-null terminated string.
- for (PWSTR tempInterfacePtr = interfaceList.get(); *tempInterfacePtr; tempInterfacePtr += wcslen(tempInterfacePtr) + 1)
- {
- hr = CreateInterfaceForSerial(tempInterfacePtr, &_HandleComm);
-
- // If we can create the interface, determine if a NMEA messeage comes out of the port
- if (SUCCEEDED(hr))
- {
- // Make sure _NmeaMessageBuf ends with null-terminated character by not filling the last index.
- if (!ReadFile(_HandleComm, _NmeaMessageBuf, sizeof(_NmeaMessageBuf) - 1, &bytesWritten, nullptr))
- {
- CloseHandler(_HandleComm);
- continue;
- }
- memset(&_NmeaMessageBuf[bytesWritten], 0, sizeof(_NmeaMessageBuf) - bytesWritten);
-
- // Validate that the output is a NMEA format
- if (!IsNMEASentence(_NmeaMessageBuf))
- {
- CloseHandler(_HandleComm);
- continue;
- }
-
- // A valid COM port is found. Stop the processing
- foundPort = true;
- break;
- }
- }
-
- return foundPort;
-}
-
-HRESULT
-CNmeaProcessor::CreateInterfaceForSerial(
- _In_ LPCWSTR SerialPortName,
- _Out_ HANDLE* HandleComm
-)
-{
- HRESULT hr = S_OK;
- DCB dcbSerialParams = {};
- COMMTIMEOUTS timeouts = {};
- HANDLE handleComm = INVALID_HANDLE_VALUE;
-
- // Create Serial interface
- handleComm = CreateFileW(SerialPortName,
- GENERIC_READ,
- 0,
- 0,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- 0);
-
- if (handleComm == INVALID_HANDLE_VALUE)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit;
- }
-
- // Get current DCB
- if (!GetCommState(handleComm, &dcbSerialParams))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit;
- }
-
- // Set new serial parameters
- dcbSerialParams.DCBlength = sizeof(dcbSerialParams);
- dcbSerialParams.BaudRate = CBR_4800;
- dcbSerialParams.ByteSize = 8;
- dcbSerialParams.StopBits = ONESTOPBIT;
- dcbSerialParams.Parity = NOPARITY;
-
- if (!SetCommState(handleComm, &dcbSerialParams))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit;
- }
-
- // Initialize timeout parameters in milliseconds
- timeouts.ReadIntervalTimeout = 50;
- timeouts.ReadTotalTimeoutConstant = 50;
- timeouts.ReadTotalTimeoutMultiplier = 50;
- timeouts.WriteTotalTimeoutConstant = 50;
- timeouts.WriteTotalTimeoutMultiplier = 10;
-
- if (!SetCommTimeouts(handleComm, &timeouts))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit;
- }
-
- *HandleComm = handleComm;
-
-Exit:
- if (FAILED(hr))
- {
- CloseHandler(handleComm);
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_NMEA, "CreateInterfaceForSerial failed at %ws with hr: %x", SerialPortName, hr);
- }
-
- return hr;
-}
-
-HRESULT
-CNmeaProcessor::ReadNmeaSentenceFromSerial()
-{
- EnterCriticalSection(&_Lock);
-
- HRESULT hr = S_OK;
- DWORD bytesWritten;
-
- // If the communication handle is not set, try to create it
- if (_HandleComm == INVALID_HANDLE_VALUE || _HandleComm == nullptr)
- {
- if (!SetCommHandleForSerial())
- {
- hr = E_FAIL;
- goto Exit;
- }
- }
-
- // Make sure _NmeaMessageBuf ends with null-terminated character by not filling the last index.
- if (!ReadFile(_HandleComm, _NmeaMessageBuf, sizeof(_NmeaMessageBuf) - 1, &bytesWritten, nullptr))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- CloseHandler(_HandleComm);
- goto Exit;
- }
- memset(&_NmeaMessageBuf[bytesWritten], 0, sizeof(_NmeaMessageBuf) - bytesWritten);
-
-Exit:
- LeaveCriticalSection(&_Lock);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_NMEA, "ReadNmeaSentenceFromSerial failed with hr: %x", hr);
- }
-
- return hr;
-}
-
-NTSTATUS
-CNmeaProcessor::ReadNextNmeaSentence(
- _Out_ PGNSS_FIXDATA GnssFixData
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- // Initialize the output. If reading or parsing fails, the output cannot be used as valid data
- GnssFixData->FixLevelOfDetails = 0;
- GnssFixData->IsFinalFix = 0;
-
- // Read NMEA messages
- //
- // TODO: You can choose target HW interface among available options such as Serial and Bluetooth.
- // ReadNmeaSentenceFromSerial provides an example of retrieving the incoming data from Serial interface.
- //
- status = ReadNmeaSentenceFromSerial();
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_NMEA, "ReadNmeaSentenceFromSerial failed with %!STATUS!", status);
- return status;
- }
-
- // Parse the NMEA messages
- status = ParseNmeaSentence(GnssFixData);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_NMEA, "ParseNmeaSentence failed with %!STATUS!", status);
- return status;
- }
-
- return status;
-}
-
-bool
-CNmeaProcessor::IsNMEASentence(
- _In_ PCSTR NmeaBuf
-)
-{
- std::size_t sentenceStart = 0;
- std::string nmeaStr(NmeaBuf);
-
- // Fast-forward to the first sentence by identifying the first start character '$'
- if (!FindFirstStartOfSequence(nmeaStr, &sentenceStart))
- {
- return false;
- }
-
- // If the checksum is correct in the sequence, we confrim that this is a NMEA sentence
- return IsValidChecksum(nmeaStr.substr(sentenceStart));
-}
-
-bool
-CNmeaProcessor::FindFirstStartOfSequence(
- _In_ const std::string& NmeaMessageStr,
- _Out_ std::size_t* StartIndex
-)
-{
- std::size_t found;
-
- // Find start of sequence
- found = NmeaMessageStr.find_first_of('$');
- if (found == std::string::npos)
- {
- return false;
- }
-
- if (StartIndex != nullptr)
- {
- *StartIndex = found;
- }
-
- return true;
-}
-
-bool
-CNmeaProcessor::FindFirstChecksumDelimeter(
- _In_ const std::string& NmeaMessageStr,
- _Out_ std::size_t* StartIndex
-)
-{
- std::size_t found;
-
- // Find checksum delimiter, which is followed by the checksum
- found = NmeaMessageStr.find_first_of('*');
- if (found == std::string::npos)
- {
- return false;
- }
-
- if (StartIndex != nullptr)
- {
- *StartIndex = found;
- }
-
- return true;
-}
-
-bool
-CNmeaProcessor::FindFirstEndingOfSequence(
- _In_ const std::string& NmeaMessageStr,
- _Out_ std::size_t* StartIndex
-)
-{
- std::size_t foundCR;
- std::size_t foundLF;
-
- //
- // Find consecutive CR + LF, and set LF as a ending index of sequence in the sentence
- //
-
- foundCR = NmeaMessageStr.find_first_of('\r');
- if (foundCR == std::string::npos)
- {
- return false;
- }
-
- foundLF = NmeaMessageStr.substr(foundCR).find_first_of('\n');
- if (foundLF != 1)
- {
- return false;
- }
-
- if (StartIndex != nullptr)
- {
- *StartIndex = foundCR + 1;
- }
-
- return true;
-}
-
-bool
-CNmeaProcessor::IsValidChecksum(
- _In_ std::string NmeaMessageStr
-)
-{
- BYTE calculatedChecksum = 0;
- std::size_t startSequence;
- std::size_t checksumDelimeter;
-
- // Validate that there is start of sequence
- if (!FindFirstStartOfSequence(NmeaMessageStr, &startSequence))
- {
- return false;
- }
-
- // Validate that there is checksum delimiter
- if (!FindFirstChecksumDelimeter(NmeaMessageStr, &checksumDelimeter))
- {
- return false;
- }
-
- // Validate that there is end of sequence
- if (!FindFirstEndingOfSequence(NmeaMessageStr, nullptr))
- {
- return false;
- }
-
- // Calculate checksum on the fly to compare with the value in checksum field
- for (std::size_t i = startSequence + 1; i < checksumDelimeter; i++)
- {
- calculatedChecksum = calculatedChecksum ^ NmeaMessageStr[i];
- }
-
- // Validate the checksum field, which consists of two characters
- BYTE valueInChecksumField = static_cast<BYTE>(stoul(NmeaMessageStr.substr(checksumDelimeter + 1, 2), nullptr, 16));
- if (calculatedChecksum != valueInChecksumField)
- {
- return false;
- }
-
- return true;
-}
-
-NTSTATUS
-CNmeaProcessor::ParseNmeaSentence(
- _Out_ PGNSS_FIXDATA GnssFixData
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
- std::string nmeaMessageStr(_NmeaMessageBuf);
- std::size_t sentenceStart = 0;
- std::size_t checksumDelimeter = 0;
- std::size_t sentenceEnd = 0;
-
- while (sentenceEnd != std::string::npos)
- {
- // Fast-forward to the first sentence by identifying the first start character '$'
- if (!FindFirstStartOfSequence(nmeaMessageStr, &sentenceStart))
- {
- break;
- }
- nmeaMessageStr = nmeaMessageStr.substr(sentenceStart);
-
- // Validate the checksum
- if (!IsValidChecksum(nmeaMessageStr))
- {
- // We discard the buffer if current sentence is not valid
- // It would be safer to start over and read a new buffer
- break;
- }
-
- // Find where checksum delimeter is located. This points out the end of current sentence body
- if (!FindFirstChecksumDelimeter(nmeaMessageStr, &checksumDelimeter))
- {
- break;
- }
-
- // Parse sentence body
- ParseSentenceWrapper(nmeaMessageStr, checksumDelimeter, GnssFixData);
-
- // Go to the end of the current sentence
- if (!FindFirstEndingOfSequence(nmeaMessageStr, &sentenceEnd))
- {
- break;
- }
- nmeaMessageStr = nmeaMessageStr.substr(sentenceEnd);
- }
-
- return status;
-}
-
-void
-CNmeaProcessor::ParseSentenceWrapper(
- _In_ std::string NmeaMessageStr,
- _In_ std::size_t SentenceBodySize,
- _Out_ PGNSS_FIXDATA GnssFixData
-)
-{
- std::string addrField;
-
- // Parse sentence type from address field and select a correct body parser for the fields
- addrField = NmeaMessageStr.substr(1, 5);
- if (addrField == "GPGGA")
- {
- ParseGPGGASentence(NmeaMessageStr.substr(0, SentenceBodySize), GnssFixData);
- }
- else if (addrField == "GPRMC")
- {
- ParseGPRMCSentence(NmeaMessageStr.substr(0, SentenceBodySize), GnssFixData);
- }
- else
- {
- //
- // TODO: Add more sentence parsers as needed
- // For example, GPGSA and GPGSV are used for satellite information in detail (GNSS_SATELLITEINFO)
- //
- }
-}
-
-void
-CNmeaProcessor::ParseGPGGASentence(
- _In_ const std::string& NmaSentence,
- _Out_ PGNSS_FIXDATA GnssFix
-)
-{
- double latitude = 0;
- double longitude = 0;
- double altitude = 0;
- double degree = 0;
- double mins = 0;
- double horizontalDilution = 0;
- ULONG qualityIndicator = 0;
- ULONG satelliteCount = 0;
- NTSTATUS status = STATUS_SUCCESS;
- std::vector<std::string> nmeaFieldList;
- SYSTEMTIME systemTime = {};
- FILETIME fileTime = {};
- const std::size_t numOfGPGGAFields = 14;
-
- try
- {
- ConstructNmeaFieldList(&nmeaFieldList, NmaSentence);
-
- // Ensure GPGGA sentence contains the correct number of fields to avoid the out-of-range access
- if (nmeaFieldList.size() < numOfGPGGAFields)
- {
- throw std::out_of_range("GPGGA does not contain all the required number of fields");
- }
-
- // Retrieve UTC Time
- GetSystemTime(&systemTime); //Initialize the system time first. GGA does not set all the fields
- const std::string& time = nmeaFieldList[1];
- systemTime.wHour = static_cast<WORD>(std::stoi(time.substr(0, 2)));
- systemTime.wMinute = static_cast<WORD>(std::stoi(time.substr(2, 2)));
- systemTime.wSecond = static_cast<WORD>(std::stoi(time.substr(4, 2)));
- systemTime.wMilliseconds = static_cast<WORD>(std::stoi(time.substr(7)));
-
- // Calculate latitude
- const std::string& latitudeInfo = nmeaFieldList[2];
- degree = std::stod(latitudeInfo.substr(0, 2));
- mins = std::stod(latitudeInfo.substr(2, 7));
- latitude = degree + (mins / 60.0);
- if (nmeaFieldList[3].compare("S") == 0)
- {
- latitude = latitude * -1;
- }
-
- // Calculate longitude
- const std::string& longitudeInfo = nmeaFieldList[4];
- degree = stod(longitudeInfo.substr(0, 3));
- mins = stod(longitudeInfo.substr(3, 7));
- longitude = degree + (mins / 60.0);
- if (nmeaFieldList[5].compare("W") == 0)
- {
- longitude = longitude * -1;
- }
-
- // Retrieve GPS quality indicator
- qualityIndicator = stoi(nmeaFieldList[6]);
-
- // Retrieve Satellites used
- satelliteCount = stoi(nmeaFieldList[7]);
-
- // Retrieve horizontal dilution of precision
- horizontalDilution = stod(nmeaFieldList[8]);
-
- // Retrieve altitude
- altitude = stod(nmeaFieldList[9]);
- }
- catch (const std::exception& e)
- {
- status = STATUS_UNSUCCESSFUL;
- TraceEvents(TRACE_LEVEL_ERROR,
- TRACE_NMEA,
- "Caught exception while executing ParseGPGGASentence, error '%s' encountered while parsing '%s'", e.what(), NmaSentence.c_str());
- }
-
- // Assign the values to output structure
- SystemTimeToFileTime(&systemTime, &(GnssFix->FixTimeStamp));
- GnssFix->BasicData.Latitude = latitude;
- GnssFix->BasicData.Longitude = longitude;
- GnssFix->BasicData.Altitude = altitude;
- GnssFix->IsFinalFix = qualityIndicator == 0 ? FALSE : TRUE;
- GnssFix->AccuracyData.HorizontalAccuracy = static_cast<ULONG>(horizontalDilution + 0.5); //HorizontalAccuracy is defined as LONG
- GnssFix->SatelliteData.SatelliteCount = satelliteCount;
- GnssFix->FixLevelOfDetails |= (GNSS_FIXDETAIL_BASIC | GNSS_FIXDETAIL_ACCURACY);
- GnssFix->FixStatus = status;
-}
-
-void
-CNmeaProcessor::ParseGPRMCSentence(
- _In_ const std::string& NmaSentence,
- _Out_ PGNSS_FIXDATA GnssFix
-)
-{
- double latitude = 0;
- double longitude = 0;
- double degree = 0;
- double mins = 0;
- double speedKnots = 0;
- double course = 0;
- NTSTATUS status = STATUS_SUCCESS;
- std::vector<std::string> nmeaFieldList;
- SYSTEMTIME systemTime = {};
- FILETIME fileTime = {};
- const std::size_t numOfGPRMCFields = 13;
-
- try
- {
- ConstructNmeaFieldList(&nmeaFieldList, NmaSentence);
-
- // Ensure GPRMC sentence contains the correct number of fields to avoid the out-of-range access
- if (nmeaFieldList.size() < numOfGPRMCFields)
- {
- throw std::out_of_range("GPRMC does not contain all the required number of fields");
- }
-
- // Retrieve UTC Time
- GetSystemTime(&systemTime); //Initialize the system time first. RMC does not set all the fields
- const std::string& time = nmeaFieldList[1];
- systemTime.wHour = static_cast<WORD>(std::stoi(time.substr(0, 2)));
- systemTime.wMinute = static_cast<WORD>(std::stoi(time.substr(2, 2)));
- systemTime.wSecond = static_cast<WORD>(std::stoi(time.substr(4, 2)));
- systemTime.wMilliseconds = static_cast<WORD>(std::stoi(time.substr(7)));
-
- // Calculate latitude
- const std::string& latitudeInfo = nmeaFieldList[3];
- degree = std::stod(latitudeInfo.substr(0, 2));
- mins = std::stod(latitudeInfo.substr(2, 7));
- latitude = degree + (mins / 60.0);
- if (nmeaFieldList[4].compare("S") == 0)
- {
- latitude = latitude * -1;
- }
-
- // Calculate longitude
- const std::string& longitudeInfo = nmeaFieldList[5];
- degree = stod(longitudeInfo.substr(0, 3));
- mins = stod(longitudeInfo.substr(3, 7));
- longitude = degree + (mins / 60.0);
- if (nmeaFieldList[6].compare("W") == 0)
- {
- longitude = longitude * -1;
- }
-
- // Retrieve speed
- speedKnots = stod(nmeaFieldList[7]);
-
- // Retrieve course
- course = stod(nmeaFieldList[8]);
-
- // Retrieve UTC Date
- const std::string& utcDate = nmeaFieldList[9];
- systemTime.wDay = static_cast<WORD>(std::stoi(utcDate.substr(0, 2)));
- systemTime.wDay = static_cast<WORD>(std::stoi(utcDate.substr(0, 2)));
- systemTime.wMonth = static_cast<WORD>(std::stoi(utcDate.substr(2, 2)));
- systemTime.wYear = static_cast<WORD>(std::stoi(utcDate.substr(4, 2)));
- }
- catch (const std::exception& e)
- {
- status = STATUS_UNSUCCESSFUL;
- TraceEvents(TRACE_LEVEL_ERROR,
- TRACE_NMEA,
- "Caught exception while executing ParseGPRMCSentence, error '%s' encountered while parsing '%s'", e.what(), NmaSentence.c_str());
- }
-
- // Assign the values to output structure
- SystemTimeToFileTime(&systemTime, &(GnssFix->FixTimeStamp));
- GnssFix->BasicData.Latitude = latitude;
- GnssFix->BasicData.Longitude = longitude;
- GnssFix->BasicData.Speed = ConvertKnotsToMeterPerSecond(speedKnots);
- GnssFix->BasicData.Heading = course;
- GnssFix->FixLevelOfDetails |= GNSS_FIXDETAIL_BASIC;
- GnssFix->FixStatus = status;
-}
-
-double
-CNmeaProcessor::ConvertKnotsToMeterPerSecond(
- _In_ double Knots
-)
-{
- return Knots * 0.514444;
-}
-
-void
-CNmeaProcessor::ConstructNmeaFieldList(
- _Out_ std::vector<std::string>* NmeaFieldList,
- _In_ const std::string NmaSentence
-)
-{
- std::stringstream nmeaStream(NmaSentence);
- std::string nmeaField;
-
- // Put each field into the vector, excluding the field delimiter
- while (getline(nmeaStream, nmeaField, ','))
- {
- NmeaFieldList->push_back(nmeaField);
- }
-}
-
-void
-CNmeaProcessor::CloseHandler(
- _Out_ HANDLE& Handle
-)
-{
- if (Handle != nullptr)
- {
- CloseHandle(Handle);
- Handle = nullptr;
- }
-}
diff --git a/gnss/gnssUmdf/NmeaProcessor.h b/gnss/gnssUmdf/NmeaProcessor.h
deleted file mode 100644
index c26255db..00000000
--- a/gnss/gnssUmdf/NmeaProcessor.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- NmeaProcessor.h
-
-Abstract:
-
- This module contains NMEA parser class used by other classes within the Umdf Gnss Driver.
- For the NMEA documentation that this parser is based of, refer to https://en.wikipedia.org/wiki/NMEA_0183
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#pragma once
-
-// We enumerate through MAX_PORT and automatically find a right port to be used for NMEA messages
-#define MAX_COM_PORT 256
-
-// This buffer size is not defied by specific standard. It can change as needed.
-// If it is too large, handle the case where the buffer includes same type of NMEA messages multiple times.
-#define NMEA_READ_BUFFER_SIZE_BYTES 256
-
-class CNmeaProcessor
-{
-public:
- CNmeaProcessor();
- ~CNmeaProcessor();
-
- NTSTATUS ReadNextNmeaSentence(_Out_ PGNSS_FIXDATA GnssFixData);
-
-private:
- NTSTATUS ParseNmeaSentence(_Out_ PGNSS_FIXDATA GnssFixData);
- void ParseSentenceWrapper(_In_ std::string NmeaMessageStr, _In_ std::size_t SentenceBodySize, _Out_ PGNSS_FIXDATA GnssFixData);
- void ParseGPGGASentence(_In_ const std::string& NmaSentence, _Out_ PGNSS_FIXDATA GnssFixData);
- void ParseGPRMCSentence(_In_ const std::string& NmaSentence, _Out_ PGNSS_FIXDATA GnssFixData);
-
- void ConstructNmeaFieldList(_Out_ std::vector<std::string>* NmeaFieldList, _In_ const std::string NmaSentence);
-
- static double ConvertKnotsToMeterPerSecond(_In_ double Knots);
- static void CloseHandler(_Out_ HANDLE& Handle);
- static HRESULT CreateInterfaceForSerial(_In_ LPCWSTR SerialPortName, _Out_ HANDLE* HandleComm);
-
- HRESULT ReadNmeaSentenceFromSerial();
-
- bool SetCommHandleForSerial();
- bool IsNMEASentence(_In_ PCSTR NmeaBuf);
- bool IsValidChecksum(_In_ std::string NmeaMessageStr);
-
- bool FindFirstStartOfSequence(_In_ const std::string& NmeaMessageStr, _Out_ std::size_t* StartIndex);
- bool FindFirstChecksumDelimeter(_In_ const std::string& NmeaMessageStr, _Out_ std::size_t* StartIndex);
- bool FindFirstEndingOfSequence(_In_ const std::string& NmeaMessageStr, _Out_ std::size_t* StartIndex);
-
- CRITICAL_SECTION _Lock;
- HANDLE _HandleComm = INVALID_HANDLE_VALUE;
- CHAR _NmeaMessageBuf[NMEA_READ_BUFFER_SIZE_BYTES];
-};
diff --git a/gnss/gnssUmdf/Queue.cpp b/gnss/gnssUmdf/Queue.cpp
deleted file mode 100644
index b964a100..00000000
--- a/gnss/gnssUmdf/Queue.cpp
+++ /dev/null
@@ -1,439 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file contains the queue entry points and callbacks.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#include "precomp.h"
-#include "Trace.h"
-#include "Defaults.h"
-#include "HelperUtility.h"
-#include "Device.h"
-#include "NmeaProcessor.h"
-#include "FixSession.h"
-#include "FixHandler.h"
-#include "Queue.h"
-
-#include "Queue.tmh"
-
-
-CQueue::CQueue(
- WDFQUEUE Queue
-) :
- _Queue(Queue),
- _ForcedDriverVersion(GNSS_DRIVER_DDK_VERSION)
-{
- InitializeCriticalSection(&_Lock);
-}
-
-CQueue::~CQueue()
-{
- DeleteCriticalSection(&_Lock);
- _Queue = nullptr;
-}
-
-
-void
-CQueue::OnCleanup(
- _In_ WDFOBJECT Object
-)
-{
- CQueue *pQueue = GetQueueObject(Object);
-
- // Queue object constructed using placement 'new' so explicitly invoke destructor
- pQueue->~CQueue();
-}
-
-NTSTATUS
-CQueue::Initialize()
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- // Initialize the Fix Handler
- status = _FixHandler.Initialize(_Queue);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_ERROR, TRACE_QUEUE, "_FixHandler->Initialize failed with %!STATUS!", status);
- goto Exit;
- }
-
-Exit:
- return status;
-}
-
-void
-CQueue::OnIoDeviceControl(
- _In_ WDFQUEUE Queue,
- _In_ WDFREQUEST Request,
- _In_ size_t OutputBufferLength,
- _In_ size_t InputBufferLength,
- _In_ ULONG IoControlCode
-)
-{
- CQueue *pQueue = GetQueueObject(Queue);
-
- pQueue->OnIoDeviceControl(Request, IoControlCode, InputBufferLength, OutputBufferLength);
-}
-
-NTSTATUS
-CQueue::AddQueueToDevice(
- _In_ WDFDEVICE Device,
- _Outptr_ CQueue** Queue
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- // Setup IO queue
- //
- // Create a sequential IO Queue for serial operation and supply all the
- // callbacks. A sequential queue will cause all IO requests to be serialized
- // to the device (i.e., only one request will sent at a time).
- //
- WDF_IO_QUEUE_CONFIG queueConfig;
- WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&queueConfig,
- WdfIoQueueDispatchSequential);
-
- queueConfig.PowerManaged = WdfFalse;
- queueConfig.EvtIoDeviceControl = CQueue::OnIoDeviceControl;
-
- WDF_OBJECT_ATTRIBUTES queueAttributes;
- WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&queueAttributes,
- CQueue);
-
- queueAttributes.EvtCleanupCallback = CQueue::OnCleanup;
-
- WDFQUEUE queue = nullptr;
- status = WdfIoQueueCreate(Device,
- &queueConfig,
- &queueAttributes,
- &queue);
-
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DEVICE, "WdfIoQueueCreate failed with Status %!STATUS!", status);
- goto Exit;
- }
-
- // Construct a queue object on the preallocated buffer using placement new operation
- *Queue = new (GetQueueObject(queue)) CQueue(queue);
-
- status = (*Queue)->Initialize();
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DEVICE, "CQueue::Initialize failed with %!STATUS!", status);
- goto Exit;
- }
-
-Exit:
- return status;
-}
-
-void
-CQueue::OnIoDeviceControl(
- _In_ WDFREQUEST Request,
- _In_ ULONG IoControlCode,
- _In_ size_t InputBufferLength,
- _In_ size_t OutputBufferLength)
-{
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TRACE_QUEUE,
- "Request = %p, IoControlCode = 0x%x InputBufferLength=%d OutputBufferLength=%d",
- Request, IoControlCode, (int)InputBufferLength, (int)OutputBufferLength);
-
- NTSTATUS status = STATUS_SUCCESS;
-
- switch (IoControlCode)
- {
- // Capability Exchange
- case IOCTL_GNSS_SEND_PLATFORM_CAPABILITY:
- break;
- case IOCTL_GNSS_GET_DEVICE_CAPABILITY:
- status = GetDeviceCapability(Request);
- break;
-
- case IOCTL_GNSS_GET_CHIPSETINFO:
- status = GetChipsetInfo(Request);
- break;
-
- // Fix
- case IOCTL_GNSS_START_FIXSESSION:
- //
- // TODO: If Agnss is supported, check for Agnss data here
- //
- status = _FixHandler.StartFix(Request);
- break;
- case IOCTL_GNSS_STOP_FIXSESSION:
- status = _FixHandler.StopFix(Request);
- break;
- case IOCTL_GNSS_MODIFY_FIXSESSION:
- status = _FixHandler.ModifyFix(Request);
- break;
- case IOCTL_GNSS_GET_FIXDATA:
- status = _FixHandler.GetFixRequest(Request);
- break;
-
- // Driver Command
- case IOCTL_GNSS_SEND_DRIVERCOMMAND:
- status = HandleDriverCommand(Request);
- break;
-
- // Agnss
- case IOCTL_GNSS_INJECT_AGNSS:
- case IOCTL_GNSS_LISTEN_AGNSS:
- // Supl
- case IOCTL_GNSS_SET_SUPL_HSLP:
- case IOCTL_GNSS_CONFIG_SUPL_CERT:
- case IOCTL_GNSS_SET_V2UPL_CONFIG:
- //Ni
- case IOCTL_GNSS_LISTEN_DRIVER_REQUEST:
- case IOCTL_GNSS_RESPOND_NI:
- case IOCTL_GNSS_LISTEN_NI:
- //Geofence
- case IOCTL_GNSS_LISTEN_GEOFENCE_ALERT:
- case IOCTL_GNSS_LISTEN_GEOFENCES_TRACKINGSTATUS:
- case IOCTL_GNSS_CREATE_GEOFENCE:
- case IOCTL_GNSS_DELETE_GEOFENCE:
- // Breadcrumbing
- case IOCTL_GNSS_START_BREADCRUMBING:
- case IOCTL_GNSS_STOP_BREADCRUMBING:
- case IOCTL_GNSS_LISTEN_BREADCRUMBING_ALERT:
- case IOCTL_GNSS_POP_BREADCRUMBS:
- // Ioctls that are not implemented
- case IOCTL_GNSS_LISTEN_ERROR:
- case IOCTL_GNSS_EXECUTE_CWTEST:
- case IOCTL_GNSS_EXECUTE_SELFTEST:
- case IOCTL_GNSS_LISTEN_NMEA:
- status = STATUS_NOT_IMPLEMENTED;
- break;
-
- default:
- status = STATUS_INVALID_DEVICE_REQUEST;
- break;
- }
-
- if (status != STATUS_PENDING)
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_QUEUE, "%!FUNC! Completing Request with status %!STATUS!", status);
- WdfRequestComplete(Request, status);
- }
-}
-
-NTSTATUS
-CQueue::GetDeviceCapability(
- _In_ WDFREQUEST Request
-)
-{
- NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST;
- PGNSS_DEVICE_CAPABILITY outputParam;
-
- status = WdfRequestRetrieveOutputBuffer(Request, sizeof(*outputParam), (void**)&outputParam, nullptr);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_QUEUE, "%!FUNC! Could not retrieve output buffer for request with status = %!STATUS!", status);
- goto Exit;
- }
-
- INIT_POD_GNSS_STRUCT(outputParam);
-
- //
- // TODO: Set functionality according to what we currently support in the driver
- //
- {
- outputParam->SupportContinuousTracking = FALSE;
-
- outputParam->SupportDistanceTracking = FALSE;
-
- outputParam->GeofencingSupport = FALSE;
- outputParam->MaxGeofencesSupported = 0;
-
- outputParam->RequireAGnssInjection = FALSE;
- outputParam->AgnssFormatSupported = FALSE;
- outputParam->AgnssFormatPreferred = FALSE;
-
- outputParam->SupportCpLocation = FALSE;
- outputParam->SupportSuplV2 = FALSE;
- outputParam->SupportSuplV1 = FALSE;
- outputParam->SupportUplV2 = FALSE;
- outputParam->SupportedSuplVersion.MajorVersion = 0;
- outputParam->SupportedSuplVersion.MinorVersion = 0;
-
- outputParam->MaxGnssBreadCrumbFixes = 0;
- outputParam->GnssBreadCrumbPayloadVersion = BREADCRUMBING_UNSUPPORTED;
-
- // Update the Driver version if forced through IOCTL
- outputParam->Version = _ForcedDriverVersion;
- }
-
- WdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, sizeof(*outputParam));
- status = STATUS_PENDING;
-
-Exit:
- return status;
-}
-
-NTSTATUS
-CQueue::GetChipsetInfo(
- _In_ WDFREQUEST Request
-)
-{
- //
- // TODO: The following is an example. Replace the values accordingly
- //
- static const wchar_t s_ManufacturerID[] = L"Microsoft Test";
- static const wchar_t s_HardwareID[] = L"UMDF Gnss";
- static const wchar_t s_FirmwareVersion[] = L"1.0.0.0";
-
- NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST;
- PGNSS_CHIPSETINFO outputParam;
-
- status = WdfRequestRetrieveOutputBuffer(Request, sizeof(*outputParam), (void**)&outputParam, nullptr);
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_QUEUE, "%!FUNC! Could not retrieve output buffer for request with status = %!STATUS!", status);
- goto Exit;
- }
-
- INIT_POD_GNSS_STRUCT(outputParam);
-
- memset(&(outputParam->ManufacturerID), 0, sizeof(outputParam->ManufacturerID));
- memset(&(outputParam->HardwareID), 0, sizeof(outputParam->HardwareID));
- memset(&(outputParam->FirmwareVersion), 0, sizeof(outputParam->FirmwareVersion));
-
- memcpy_s(&(outputParam->ManufacturerID), sizeof(outputParam->ManufacturerID), &s_ManufacturerID, sizeof(s_ManufacturerID));
- memcpy_s(&(outputParam->HardwareID), sizeof(outputParam->HardwareID), &s_HardwareID, sizeof(s_HardwareID));
- memcpy_s(&(outputParam->FirmwareVersion), sizeof(outputParam->FirmwareVersion), &s_FirmwareVersion, sizeof(s_FirmwareVersion));
-
- WdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, sizeof(*outputParam));
- status = STATUS_PENDING;
-
-Exit:
- return status;
-}
-
-NTSTATUS
-CQueue::HandleDriverCommand(
- _In_ WDFREQUEST Request
-)
-{
- NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST;
- PGNSS_DRIVERCOMMAND_PARAM command = nullptr;
-
- // Check that there is enough room to output the returned GNSS_DEVICE_CAPABILITY
- status = WdfRequestRetrieveInputBuffer(Request, sizeof(*command), (void**)&command, nullptr);
-
- if (!NT_SUCCESS(status))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_QUEUE, "%!FUNC! Could not retrieve input buffer for DriverCommand request with status = %!STATUS!", status);
- goto Exit;
- }
-
- // Check that the sizes are well-formed
- if ((command->Size < (ULONG)FIELD_OFFSET(GNSS_DRIVERCOMMAND_PARAM, CommandData[command->CommandDataSize])))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_QUEUE, "Command is not formatted correctly : unexpected sizes specified");
- goto Exit;
- }
-
- switch (command->CommandType)
- {
- case GNSS_ClearAgnssData:
- status = ClearAgnssData(command);
- break;
- case GNSS_ResetEngine:
- status = ResetEngine(command);
- break;
- case GNSS_SetLocationServiceEnabled:
- status = SetLocationServiceStatus(command);
- break;
- case GNSS_ForceOperationMode:
- status = ForceOperationMode(command);
- break;
- case GNSS_SetLocationNIRequestAllowed:
- case GNSS_ResetGeofencesTracking:
- case GNSS_SetNiTimeoutInterval:
- case GNSS_SetSuplVersion:
- case GNSS_SetUplServerAccessInterval:
- //
- // TODO: Not implemented in the sample, to be implemented by the driver owners
- //
- status = STATUS_NOT_IMPLEMENTED;
- break;
- default:
- status = STATUS_INVALID_DEVICE_REQUEST;
- break;
- }
-
-Exit:
- return status;
-}
-
-NTSTATUS
-CQueue::SetLocationServiceStatus(
- _In_ PGNSS_DRIVERCOMMAND_PARAM CommandParam
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- status = GetDataFromCommand(CommandParam, &_InternalState.SetLocationServiceEnabled) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
-
- return status;
-}
-
-NTSTATUS
-CQueue::ResetEngine(
- _In_ PGNSS_DRIVERCOMMAND_PARAM /*CommandParam*/
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- _AgnssNeeded[FAKE_AGNSS_TIME_IDX] = TRUE;
- _AgnssNeeded[FAKE_AGNSS_POS_IDX] = TRUE;
- _AgnssNeeded[FAKE_AGNSS_BLOB_IDX] = TRUE;
-
- return status;
-}
-
-NTSTATUS
-CQueue::ClearAgnssData(
- _In_ PGNSS_DRIVERCOMMAND_PARAM CommandParam
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
- DWORD data = 0;
-
- if (GetDataFromCommand(CommandParam, &data))
- {
- GNSS_AGNSS_REQUEST_TYPE reqType = (GNSS_AGNSS_REQUEST_TYPE)data;
- _AgnssNeeded[reqType] = TRUE;
- }
- else
- {
- status = STATUS_UNSUCCESSFUL;
- }
-
- return status;
-}
-
-NTSTATUS
-CQueue::ForceOperationMode(
- _In_ PGNSS_DRIVERCOMMAND_PARAM CommandParam
-)
-{
- NTSTATUS status = STATUS_SUCCESS;
-
- status = GetDataFromCommand(CommandParam, &_InternalState.OperationMode) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
-
- return status;
-}
diff --git a/gnss/gnssUmdf/Queue.h b/gnss/gnssUmdf/Queue.h
deleted file mode 100644
index 6617329e..00000000
--- a/gnss/gnssUmdf/Queue.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file contains the queue definitions for the Umdf Gnss Driver.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#pragma once
-
-class CFixHandler;
-
-class CQueue
-{
-public:
- static NTSTATUS AddQueueToDevice(_In_ WDFDEVICE device, _Outptr_ CQueue** queue);
-
-private:
- enum
- {
- FAKE_AGNSS_TIME_IDX = GNSS_AGNSS_TimeInjection,
- FAKE_AGNSS_POS_IDX = GNSS_AGNSS_PositionInjection,
- FAKE_AGNSS_BLOB_IDX = GNSS_AGNSS_BlobInjection,
- FAKE_AGNSS_MAX_IDX
- };
-
- typedef struct {
- DWORD OperationMode;
- BOOL SetLocationNiRequestAllowed;
- BOOL SetLocationServiceEnabled;
- } FakeGnssStateDump;
-
- WDFQUEUE _Queue;
- CRITICAL_SECTION _Lock;
- CFixHandler _FixHandler;
- ULONG _ForcedDriverVersion = GNSS_DRIVER_DDK_VERSION;
- FakeGnssStateDump _InternalState;
- BOOL _AgnssNeeded[FAKE_AGNSS_MAX_IDX];
-
- CQueue(WDFQUEUE Queue);
- ~CQueue();
-
- static EVT_WDF_OBJECT_CONTEXT_CLEANUP OnCleanup;
- static EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL OnIoDeviceControl;
-
- NTSTATUS Initialize();
- void OnIoDeviceControl(_In_ WDFREQUEST Request,
- _In_ ULONG IoControlCode,
- _In_ size_t InputBufferLength,
- _In_ size_t OutputBufferLength);
- NTSTATUS GetDeviceCapability(_In_ WDFREQUEST Request);
- NTSTATUS GetChipsetInfo(_In_ WDFREQUEST Request);
- NTSTATUS HandleDriverCommand(_In_ WDFREQUEST Request);
- NTSTATUS ClearAgnssData(_In_ PGNSS_DRIVERCOMMAND_PARAM CommandParam);
- NTSTATUS ResetEngine(_In_ PGNSS_DRIVERCOMMAND_PARAM CommandParam);
- NTSTATUS SetLocationServiceStatus(_In_ PGNSS_DRIVERCOMMAND_PARAM CommandParam);
- NTSTATUS ForceOperationMode(_In_ PGNSS_DRIVERCOMMAND_PARAM CommandParam);
-};
-
-WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CQueue, GetQueueObject);
diff --git a/gnss/gnssUmdf/Trace.h b/gnss/gnssUmdf/Trace.h
deleted file mode 100644
index c073164c..00000000
--- a/gnss/gnssUmdf/Trace.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- Trace.h
-
-Abstract:
-
- This module contains the local type definitions for the Umdf Gnss Driver.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#pragma once
-
-//
-// Define the tracing flags.
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- GnssUmdfTraceGuid, (ceb3bf01,80e4,4dc7,b3bf,f6b5279eb8c4), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- WPP_DEFINE_BIT(TRACE_DRIVER) \
- WPP_DEFINE_BIT(TRACE_DEVICE) \
- WPP_DEFINE_BIT(TRACE_QUEUE) \
- WPP_DEFINE_BIT(TRACE_FIX) \
- WPP_DEFINE_BIT(TRACE_AGNSS) \
- WPP_DEFINE_BIT(TRACE_GEOFENCE) \
- WPP_DEFINE_BIT(TRACE_SUPL) \
- WPP_DEFINE_BIT(TRACE_HELPERUTIL) \
- WPP_DEFINE_BIT(TRACE_NMEA) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
- WPP_LEVEL_LOGGER(flags)
-
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
- (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
-// end_wpp
-
-//
-//
-// Driver specific #defines
-//
-#if UMDF_VERSION_MAJOR == 2 && UMDF_VERSION_MINOR == 0
- #define MYDRIVER_TRACING_ID L"Microsoft\\UMDF2.0\\gnssUmdf V1.0"
-#endif
diff --git a/gnss/gnssUmdf/gnssUmdf.inf b/gnss/gnssUmdf/gnssUmdf.inf
deleted file mode 100644
index f7d16763..00000000
--- a/gnss/gnssUmdf/gnssUmdf.inf
+++ /dev/null
Binary files differ
diff --git a/gnss/gnssUmdf/gnssUmdf.vcxproj b/gnss/gnssUmdf/gnssUmdf.vcxproj
deleted file mode 100644
index 88f3e45e..00000000
--- a/gnss/gnssUmdf/gnssUmdf.vcxproj
+++ /dev/null
@@ -1,177 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="Device.cpp" />
- <ClCompile Include="Driver.cpp" />
- <ClCompile Include="FixHandler.cpp" />
- <ClCompile Include="FixSession.cpp" />
- <ClCompile Include="HelperUtility.cpp" />
- <ClCompile Include="NmeaProcessor.cpp" />
- <ClCompile Include="Queue.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="precomp.h" />
- <ClInclude Include="Device.h" />
- <ClInclude Include="Driver.h" />
- <ClInclude Include="FixHandler.h" />
- <ClInclude Include="FixSession.h" />
- <ClInclude Include="HelperUtility.h" />
- <ClInclude Include="NmeaProcessor.h" />
- <ClInclude Include="Defaults.h" />
- <ClInclude Include="Queue.h" />
- <ClInclude Include="Trace.h" />
- </ItemGroup>
- <ItemGroup>
- <Inf Include="gnssUmdf.inf" />
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{AC97DD9E-781F-4FCE-8AC7-ADE57C633A13}</ProjectGuid>
- <TemplateGuid>{32909489-7be5-497b-aafa-db6669d9b44b}</TemplateGuid>
- <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
- <Configuration>Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <RootNamespace>gnssUmdf</RootNamespace>
- <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <PropertyGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
- </PropertyGroup>
- <PropertyGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
- </PropertyGroup>
- <PropertyGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
- </PropertyGroup>
- <PropertyGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor>
- <OutDir>$(ProjectDir)bin\$(Platform)\$(ConfigurationName)\</OutDir>
- <IntDir>$(ProjectDir)obj\$(Platform)\$(ConfigurationName)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor>
- <OutDir>$(ProjectDir)bin\$(Platform)\$(ConfigurationName)\</OutDir>
- <IntDir>$(ProjectDir)obj\$(Platform)\$(ConfigurationName)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor>
- <OutDir>$(ProjectDir)bin\$(Platform)\$(ConfigurationName)\</OutDir>
- <IntDir>$(ProjectDir)obj\$(Platform)\$(ConfigurationName)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor>
- <OutDir>$(ProjectDir)bin\$(Platform)\$(ConfigurationName)\</OutDir>
- <IntDir>$(ProjectDir)obj\$(Platform)\$(ConfigurationName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <WppEnabled>true</WppEnabled>
- <WppRecorderEnabled>true</WppRecorderEnabled>
- <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <ExceptionHandling>Sync</ExceptionHandling>
- <PrecompiledHeader>Create</PrecompiledHeader>
- <PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WppEnabled>true</WppEnabled>
- <WppRecorderEnabled>true</WppRecorderEnabled>
- <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <ExceptionHandling>Sync</ExceptionHandling>
- <PrecompiledHeader>Create</PrecompiledHeader>
- <PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <WppEnabled>true</WppEnabled>
- <WppRecorderEnabled>true</WppRecorderEnabled>
- <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <ExceptionHandling>Sync</ExceptionHandling>
- <PrecompiledHeader>Create</PrecompiledHeader>
- <PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WppEnabled>true</WppEnabled>
- <WppRecorderEnabled>true</WppRecorderEnabled>
- <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <ExceptionHandling>Sync</ExceptionHandling>
- <PrecompiledHeader>Create</PrecompiledHeader>
- <PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <FilesToPackage Include="$(TargetPath)" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/gnss/gnssUmdf/gnssUmdf.vcxproj.filters b/gnss/gnssUmdf/gnssUmdf.vcxproj.filters
deleted file mode 100644
index 787d333d..00000000
--- a/gnss/gnssUmdf/gnssUmdf.vcxproj.filters
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- <Filter Include="Driver Files">
- <UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier>
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <Inf Include="gnssUmdf.inf">
- <Filter>Driver Files</Filter>
- </Inf>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="Device.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Driver.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Queue.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Trace.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="HelperUtility.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Defaults.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="FixHandler.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="FixSession.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="precomp.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="NmeaProcessor.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="Device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="HelperUtility.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="FixHandler.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="FixSession.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="NmeaProcessor.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/gnss/gnssUmdf/precomp.h b/gnss/gnssUmdf/precomp.h
deleted file mode 100644
index e07f2171..00000000
--- a/gnss/gnssUmdf/precomp.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- precomp.h
-
-Abstract:
-
- This module contains the common type definitions and includes.
-
-Environment:
-
- Windows User-Mode Driver Framework
-
---*/
-
-#pragma once
-
-//
-// Include the type specific headers.
-//
-#include <windows.h>
-#include <wdf.h>
-#include <initguid.h>
-#include <sstream>
-#include <vector>
-#include <gnssdriver.h>