Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ILocationSync] Update with JSON-RPC interface #407

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions definitions/Definitions.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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 @@ -80,6 +79,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>
<ClInclude Include="ValuePoint.h" />
<CustomBuild Include="..\interfaces\IMath.h">
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)../interfaces/json/JMath.h</Outputs>
Expand Down Expand Up @@ -265,9 +278,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
38 changes: 4 additions & 34 deletions definitions/Definitions.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
<ClCompile Include="..\interfaces\json\JsonEnum_NetworkControl.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_BluetoothControl.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_BluetoothRemoteControl.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_Browser.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -75,9 +69,6 @@
<ClCompile Include="..\interfaces\json\JsonEnum_Dictionary.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_DisplayInfo.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_DTV.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
Expand All @@ -90,12 +81,6 @@
<ClCompile Include="..\interfaces\json\JsonEnum_IOConnector.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_IOControl.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 All @@ -117,9 +102,6 @@
<ClCompile Include="..\interfaces\json\JsonEnum_PerformanceMonitor.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_PlayerInfo.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_Power.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
Expand All @@ -138,9 +120,6 @@
<ClCompile Include="..\interfaces\json\JsonEnum_SecurityAgent.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_Spark.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_StateControl.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
Expand All @@ -159,9 +138,6 @@
<ClCompile Include="..\interfaces\json\JsonEnum_TimeZone.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_TraceControl.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="..\interfaces\json\JsonEnum_ValuePoint.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -195,12 +171,6 @@
</None>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\jsonrpc\BluetoothControl.json">
<Filter>Contracts</Filter>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\BluetoothRemoteControl.json">
<Filter>Contracts</Filter>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\Browser.json">
<Filter>Contracts</Filter>
</CustomBuild>
Expand Down Expand Up @@ -240,9 +210,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 @@ -321,5 +288,8 @@
<CustomBuild Include="..\interfaces\IMessenger.h">
<Filter>Interfaces</Filter>
</CustomBuild>
<CustomBuild Include="..\interfaces\ILocationSync.h">
<Filter>Interfaces</Filter>
</CustomBuild>
</ItemGroup>
</Project>
</Project>
69 changes: 69 additions & 0 deletions interfaces/ILocationSync.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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 @uncompliant:collapsed @text:legacy_lowercase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove uncompliant as there are no methods/properties with input parameters.

struct EXTERNAL ILocationSync : virtual public Core::IUnknown {

enum { ID = ID_LOCATIONSYNC };

struct locationinfo {
string city /* @brief City name (e.g. Wroclaw) */;
string country /* @brief Country name (e.g. Poland) */;
string region /* @brief Region name (e.g. Silesia) */;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, depending on the service we are calling, not all services will or can return a value for these settings. I think the once I always saw where city/country and publicIP. So to indicate such a "missing" piece of information I would prefer to have her at least around (region/timezone, maybe city and or country as well) the Core::OptionalType<> So that you know that t is available or not. I guess empty strings might lead to assumptions :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think the public_ip is the "only" mandatory, always available field ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed each field to Core::OptionalType<> like we discussed on Skype, and @deprecated to both timeZone and publicIP

string timeZone /* @brief Time zone information (e.g. CET-1CEST,M3.5.0,M10.5.0/3) */;
string publicIP /* @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
virtual void LocationChange() = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm interesting wording :-) Is it a LocationChange (we Moved??) or a LocationUpdate, we have different information..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is attempting to keep backward compatibility, but indeed we do have (a)alt tag to correct this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed it to Updated() like we discussed on Skype, and added // @alt:deprecated locationchange

};

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

}
3 changes: 3 additions & 0 deletions interfaces/Ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ namespace Exchange {

ID_SYSTEMAUDIOPLAYER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x520,
ID_SYSTEMAUDIOPLAYER_NOTIFICATION = ID_SYSTEMAUDIOPLAYER + 1,

ID_LOCATIONSYNC = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x530,
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 @@ -127,6 +127,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>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
Expand Down
87 changes: 0 additions & 87 deletions jsonrpc/LocationSync.json

This file was deleted.

Loading