diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index c4e9c290..0d623dd7 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -36,7 +36,6 @@ - @@ -78,6 +77,20 @@ python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --case-convention legacy --keep-empty -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --case-convention legacy --keep-empty -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force + ClInclude + ClInclude + ClInclude + ClInclude + $(ProjectDir)../interfaces/json/JLocationSync.h + $(ProjectDir)../interfaces/json/JLocationSync.h + $(ProjectDir)../interfaces/json/JLocationSync.h + $(ProjectDir)../interfaces/json/JLocationSync.h + python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force @@ -288,9 +301,6 @@ Document - - Document - Document diff --git a/definitions/Definitions.vcxproj.filters b/definitions/Definitions.vcxproj.filters index 64facd7b..aa17d32f 100644 --- a/definitions/Definitions.vcxproj.filters +++ b/definitions/Definitions.vcxproj.filters @@ -78,9 +78,6 @@ Generated Files - - Generated Files - Generated Files @@ -207,9 +204,6 @@ Contracts - - Contracts - Contracts @@ -285,6 +279,9 @@ Interfaces + + Interfaces + Interfaces diff --git a/interfaces/ILocationSync.h b/interfaces/ILocationSync.h new file mode 100644 index 00000000..2d1be159 --- /dev/null +++ b/interfaces/ILocationSync.h @@ -0,0 +1,70 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2021 Metrological + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "Module.h" + +namespace Thunder { + +namespace Exchange { + + // @json 1.0.0 @text:legacy_lowercase + struct EXTERNAL ILocationSync : virtual public Core::IUnknown { + + enum { ID = ID_LOCATIONSYNC }; + + struct LocationInfo { + Core::OptionalType city /* @brief City name (e.g. Wroclaw) */; + Core::OptionalType country /* @brief Country name (e.g. Poland) */; + Core::OptionalType region /* @brief Region name (e.g. Silesia) */; + Core::OptionalType timeZone /* @deprecated @brief Time zone information (e.g. CET-1CEST,M3.5.0,M10.5.0/3) */; + Core::OptionalType publicIP /* @deprecated @brief Public IP (e.g. 78.11.117.118) */; + }; + + // @event + struct EXTERNAL INotification : virtual public Core::IUnknown { + + enum { ID = ID_LOCATIONSYNC_NOTIFICATION }; + + // @brief Signals a location change + // @alt:deprecated locationchange + virtual void Updated() = 0; + }; + + virtual Core::hresult Register(INotification* const notification) = 0; + virtual Core::hresult Unregister(const INotification* const notification) = 0; + + // @brief Synchronize the location + // @retval ERROR_GENERAL Failed to synchdonize the location + // @retval ERROR_UNAVAILABLE Locator is not available + // @retval ERROR_INCORRECT_URL The URL is incorrect + // @retval ERROR_INPROGRESS Probing is still in progress + virtual Core::hresult Sync() = 0; + + // @property + // @brief Get information about the location + // @retval ERROR_UNAVAILABLE Either the internet or the location information is not available + virtual Core::hresult Location(LocationInfo& info /* @out */) const = 0; + + }; + +} // namespace Exchange + +} diff --git a/interfaces/Ids.h b/interfaces/Ids.h index 8289f1eb..df7b9105 100644 --- a/interfaces/Ids.h +++ b/interfaces/Ids.h @@ -395,7 +395,10 @@ namespace Exchange { ID_DEVICEIDENTIFICATION = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x540, - ID_SECURITYAGENT = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x550 + ID_SECURITYAGENT = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x550, + + ID_LOCATIONSYNC = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x560, + ID_LOCATIONSYNC_NOTIFICATION = ID_LOCATIONSYNC + 1 }; } } diff --git a/interfaces/Interfaces.vcxproj b/interfaces/Interfaces.vcxproj index 6ad03d73..82c51818 100644 --- a/interfaces/Interfaces.vcxproj +++ b/interfaces/Interfaces.vcxproj @@ -128,6 +128,7 @@ + diff --git a/interfaces/Interfaces.vcxproj.filters b/interfaces/Interfaces.vcxproj.filters index 50c3ebf5..0fb7e737 100644 --- a/interfaces/Interfaces.vcxproj.filters +++ b/interfaces/Interfaces.vcxproj.filters @@ -419,6 +419,9 @@ Interface Files + + Interface Files + Interface Files diff --git a/jsonrpc/LocationSync.json b/jsonrpc/LocationSync.json deleted file mode 100644 index 14053f0d..00000000 --- a/jsonrpc/LocationSync.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "Location Sync API", - "class": "LocationSync", - "description": "Location Sync JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "methods": { - "sync": { - "summary": "Synchronizes the location", - "result": { - "$ref": "#/common/results/void" - }, - "errors": [ - { - "description": "Failed to synchdonize the location", - "$ref": "#/common/errors/general" - }, - { - "description": "Unavailable locator", - "$ref": "#/common/errors/unavailable" - }, - { - "description": "Incorrect URL", - "$ref": "#/common/errors/incorrecturl" - }, - { - "description": "Probing in progress", - "$ref": "#/common/errors/inprogress" - } - ] - } - }, - "properties": { - "location": { - "summary": "Location information", - "readonly": true, - "params": { - "type": "object", - "properties": { - "city": { - "description": "City name", - "type": "string", - "example": "Wroclaw" - }, - "country": { - "description": "Country name", - "type": "string", - "example": "Poland" - }, - "region": { - "description": "Region name", - "type": "string", - "example": "Wroclaw" - }, - "timezone": { - "description": "Time zone information", - "type": "string", - "example": "CET-1CEST,M3.5.0,M10.5.0/3" - }, - "publicip": { - "description": "Public IP", - "type": "string", - "example": "78.11.117.118" - } - }, - "required": [ - "city", - "country", - "region", - "timezone", - "publicip" - ] - } - } - }, - "events": { - "locationchange": { - "summary": "Signals a location change" - } - } -}