Skip to content

Commit

Permalink
[ILocationSync] Update with JSON-RPC interface (#407)
Browse files Browse the repository at this point in the history
* Create ILocationSync and remove LocationSync.json

* Formatting changes

* More slight formatting changes

* Remove LocationSync.json from the project file

* Remove deleted .json files from project files

* Remove ProxyStubs_VoiceHandler.cpp from the project file

* Make sure to keep LocationSync.json removed from project files after the merge

* Make sure that JLocationSync is properly generated on Windows

* Remove retval on success, add examples, correct timeZone and publicIP casing

* Make sure that structs are Pascal case

* Update the casing in the method

* Remove uncompliant tag, make each member of LocationInfo optional, rename LocationChange to Updated
  • Loading branch information
VeithMetro authored Feb 10, 2025
1 parent a5fea3e commit 12487a4
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 98 deletions.
18 changes: 14 additions & 4 deletions definitions/Definitions.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<ClCompile Include="..\interfaces\json\JsonEnum_FirmwareControl.cpp" />
<ClCompile Include="..\interfaces\json\JsonEnum_InputSwitch.cpp" />
<ClCompile Include="..\interfaces\json\JsonEnum_IOConnector.cpp" />
<ClCompile Include="..\interfaces\json\JsonEnum_LocationSync.cpp" />
<ClCompile Include="..\interfaces\json\JsonEnum_Math.cpp" />
<ClCompile Include="..\interfaces\json\JsonEnum_MessageControl.cpp" />
<ClCompile Include="..\interfaces\json\JsonEnum_Messenger.cpp" />
Expand Down Expand Up @@ -78,6 +77,20 @@
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --case-convention legacy --keep-empty -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --case-convention legacy --keep-empty -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force</Command>
</CustomBuild>
<CustomBuild Include="..\interfaces\ILocationSync.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force</Command>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ClInclude</OutputItemType>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ClInclude</OutputItemType>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ClInclude</OutputItemType>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ClInclude</OutputItemType>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)../interfaces/json/JLocationSync.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)../interfaces/json/JLocationSync.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)../interfaces/json/JLocationSync.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)../interfaces/json/JLocationSync.h</Outputs>
</CustomBuild>
<CustomBuild Include="..\interfaces\ISecurityAgent.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">python "$(ToolPath)\JsonGenerator\JsonGenerator.py" -I "$(FrameworkPath)\" -I "$(ProjectDir)\" --keep-empty --case-convention legacy -c -j "$(ProjectDir)../interfaces" -o "$(ProjectDir)../interfaces/json" "%(FullPath)" --force</Command>
Expand Down Expand Up @@ -288,9 +301,6 @@
<CustomBuild Include="..\jsonrpc\IOConnector.json">
<FileType>Document</FileType>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\LocationSync.json">
<FileType>Document</FileType>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\Monitor.json">
<FileType>Document</FileType>
</CustomBuild>
Expand Down
9 changes: 3 additions & 6 deletions definitions/Definitions.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@
<ClCompile Include="..\interfaces\json\JsonEnum_IOConnector.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_LocationSync.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_Math.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -207,9 +204,6 @@
<CustomBuild Include="..\jsonrpc\IOConnector.json">
<Filter>Contracts</Filter>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\LocationSync.json">
<Filter>Contracts</Filter>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\Netflix.json">
<Filter>Contracts</Filter>
</CustomBuild>
Expand Down Expand Up @@ -285,6 +279,9 @@
<CustomBuild Include="..\interfaces\IMessenger.h">
<Filter>Interfaces</Filter>
</CustomBuild>
<CustomBuild Include="..\interfaces\ILocationSync.h">
<Filter>Interfaces</Filter>
</CustomBuild>
<CustomBuild Include="..\interfaces\ISecurityAgent.h">
<Filter>Interfaces</Filter>
</CustomBuild>
Expand Down
70 changes: 70 additions & 0 deletions interfaces/ILocationSync.h
Original file line number Diff line number Diff line change
@@ -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<string> city /* @brief City name (e.g. Wroclaw) */;
Core::OptionalType<string> country /* @brief Country name (e.g. Poland) */;
Core::OptionalType<string> region /* @brief Region name (e.g. Silesia) */;
Core::OptionalType<string> timeZone /* @deprecated @brief Time zone information (e.g. CET-1CEST,M3.5.0,M10.5.0/3) */;
Core::OptionalType<string> 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

}
5 changes: 4 additions & 1 deletion interfaces/Ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
}
1 change: 1 addition & 0 deletions interfaces/Interfaces.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<ClInclude Include="IIPNetwork.h" />
<ClInclude Include="IKeyHandler.h" />
<ClInclude Include="ILanguageTag.h" />
<ClInclude Include="ILocationSync.h" />
<ClInclude Include="IMemory.h" />
<ClInclude Include="IMessageControl.h" />
<ClInclude Include="INetflix.h" />
Expand Down
3 changes: 3 additions & 0 deletions interfaces/Interfaces.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@
<ClInclude Include="IZigWave.h">
<Filter>Interface Files</Filter>
</ClInclude>
<ClInclude Include="ILocationSync.h">
<Filter>Interface Files</Filter>
</ClInclude>
<ClInclude Include="ISecurityAgent.h">
<Filter>Interface Files</Filter>
</ClInclude>
Expand Down
87 changes: 0 additions & 87 deletions jsonrpc/LocationSync.json

This file was deleted.

0 comments on commit 12487a4

Please sign in to comment.