Skip to content

Commit

Permalink
[Interfaces] Sync with Main
Browse files Browse the repository at this point in the history
  • Loading branch information
MFransen69 committed Feb 4, 2021
1 parent dd9b8d1 commit 2517a5a
Show file tree
Hide file tree
Showing 20 changed files with 900 additions and 113 deletions.
11 changes: 11 additions & 0 deletions definitions/Definitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ ENUM_CONVERSION_BEGIN(Exchange::IPower::PCState)
{ Exchange::IPower::PowerOff, _TXT(_T("off")) },
ENUM_CONVERSION_END(Exchange::IPower::PCState)

ENUM_CONVERSION_BEGIN(Exchange::External::Metadata::protocol)
{ Exchange::External::Metadata::protocol::I2C, _TXT(_T("I2C")) },
{ Exchange::External::Metadata::protocol::ONEWIRE, _TXT(_T("1W")) },
{ Exchange::External::Metadata::protocol::NRF24L01, _TXT(_T("NRF24L01")) },
{ Exchange::External::Metadata::protocol::GPIO, _TXT(_T("GPIO")) },
{ Exchange::External::Metadata::protocol::ZWAVE, _TXT(_T("ZWave")) },
{ Exchange::External::Metadata::protocol::ZIGBEE, _TXT(_T("ZigBee")) },
{ Exchange::External::Metadata::protocol::JSONRPC, _TXT(_T("JSONRPC")) },
{ Exchange::External::Metadata::protocol::VIRTUAL, _TXT(_T("Virtual")) },
ENUM_CONVERSION_END(Exchange::External::Metadata::protocol)

namespace Exchange
{

Expand Down
14 changes: 9 additions & 5 deletions definitions/Definitions.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<ClCompile Include="Definitions.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\interfaces\json\ExternalMetadata.h" />
<ClInclude Include="definitions.h" />
<ClInclude Include="Module.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\jsonrpc\BluetoothControl.json">
Expand Down Expand Up @@ -208,7 +208,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\artifacts\$(Configuration)\</OutDir>
<IntDir>$(OutDir)Interfaces\$(TargetName)\</IntDir>
<IntDir>$(OutDir)WebBridge\$(TargetName)\</IntDir>
<CustomBuildBeforeTargets>
</CustomBuildBeforeTargets>
<CustomBuildAfterTargets>
Expand All @@ -217,7 +217,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\artifacts\$(Configuration)\</OutDir>
<IntDir>$(OutDir)Interfaces\$(TargetName)\</IntDir>
<IntDir>$(OutDir)WebBridge\$(TargetName)\</IntDir>
<CustomBuildBeforeTargets>
</CustomBuildBeforeTargets>
<CustomBuildAfterTargets>
Expand All @@ -226,7 +226,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\artifacts\$(Configuration)\</OutDir>
<IntDir>$(OutDir)Interfaces\$(TargetName)\</IntDir>
<IntDir>$(OutDir)WebBridge\$(TargetName)\</IntDir>
<CustomBuildBeforeTargets>
</CustomBuildBeforeTargets>
<CustomBuildAfterTargets>
Expand All @@ -235,7 +235,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\artifacts\$(Configuration)\</OutDir>
<IntDir>$(OutDir)Interfaces\$(TargetName)\</IntDir>
<IntDir>$(OutDir)WebBridge\$(TargetName)\</IntDir>
<CustomBuildBeforeTargets>
</CustomBuildBeforeTargets>
<CustomBuildAfterTargets>
Expand All @@ -255,6 +255,7 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<PreBuildEvent>
<Command>
Expand Down Expand Up @@ -303,6 +304,7 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<PreBuildEvent>
<Command>
Expand Down Expand Up @@ -355,6 +357,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<PreBuildEvent>
<Command>
Expand Down Expand Up @@ -407,6 +410,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
<PreBuildEvent>
<Command>
Expand Down
1 change: 1 addition & 0 deletions definitions/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <interfaces/IStream.h>
#include <interfaces/IVoiceHandler.h>
#include <interfaces/IPower.h>
#include <interfaces/json/ExternalMetadata.h>

namespace WPEFramework {

Expand Down
6 changes: 6 additions & 0 deletions interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set(GENERATOR_SEARCH_PATH ${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${NAME
ProxyStubGenerator(INPUT "${CMAKE_CURRENT_SOURCE_DIR}" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH ${GENERATOR_SEARCH_PATH})

file(GLOB INTERFACES_HEADERS I*.h)
file(GLOB JSON_HEADERS json/*.h)
list(APPEND INTERFACES_HEADERS Module.h)

file(GLOB PROXY_STUB_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/generated/ProxyStubs*.cpp")
Expand Down Expand Up @@ -73,3 +74,8 @@ install(
FILES ${INTERFACES_HEADERS}
DESTINATION include/${NAMESPACE}/interfaces
)

install(
FILES ${JSON_HEADERS}
DESTINATION include/${NAMESPACE}/interfaces/json
)
115 changes: 115 additions & 0 deletions interfaces/IApplication.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2020 RDK Management
*
* 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 WPEFramework {
namespace Exchange {

// @json
struct EXTERNAL IApplication : virtual public Core::IUnknown {

enum { ID = ID_APPLICATION };

virtual ~IApplication() = default;

/* @event */
struct EXTERNAL INotification : virtual public Core::IUnknown {
enum { ID = ID_APPLICATION_NOTIFICATION };

virtual ~INotification() = default;

/* @brief Application visibility changes */
/* @param hidden Denotes if application is currently hidden */
virtual void VisibilityChange(const bool hidden) = 0;
};

enum resettype : uint8_t {
FACTORY,
CACHE,
CREDENTIALS,
RECORDINGS
};

enum launchpointtype : uint8_t {
UNDEFINED,
DIAL,
DEDICATED_BUTTON,
DEDICATED_ICON,
APPLICATION_LIST,
INTEGRATED_TILE,
SEARCH_RESULT,
SEARCH_CONTINUATION,
VOICE_CONTROL,
VOICE_SEARCH_RESULT,
VISUAL_GESTURE,
TOUCH_GESTURE,
EPG_GRID,
CHANNEL_NUMBER,
CHANNEL_ZAP,
CHANNEL_BAR,
WEB_BROWSER,
POWER_ON,
POWER_ON_FROM_DEDICATED_BUTTON,
SUSPENDED_POWER_ON,
RESTART,
SUSPENDED_RESTART,
RESUMED_FROM_SCREENSERVER,
RESUMED_FROM_STANDBY,
BANNER_AD,
TITLE_RECOMENDATION,
APPLICATION_PROMOTION
};

virtual void Register(INotification* sink) = 0;
virtual void Unregister(INotification* sink) = 0;

// @brief Resets application data
// @param type Type of reset to perform
virtual uint32_t Reset(const resettype type) = 0;

// @property
// @brief Application-specific identification string
// @param id Identifier string
virtual uint32_t Identifier(string& id /* @out */) const = 0;

// @property
// @brief URI of the associated application-specific content
// @param link Content URI (e.g. https://youtube.com)
virtual uint32_t ContentLink(const string& link) = 0;

// @property
// @brief Application launching point
virtual uint32_t LaunchPoint(launchpointtype& point /* @out */) const = 0;
virtual uint32_t LaunchPoint(const launchpointtype&) = 0;

// @property
// @brief Current application visibility
virtual uint32_t Visible(bool& visiblity /* @out */) const = 0;
virtual uint32_t Visible(const bool&) = 0;

// @property
// @brief Current application user interface language
// @param language Language string as per RFC5646 (e.g. en)
virtual uint32_t Language(string& language /* @out */) const = 0;
virtual uint32_t Language(const string&) = 0;
};
}
}
31 changes: 31 additions & 0 deletions interfaces/IBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,23 @@ namespace Exchange {
enum { ID = ID_WEBKITBROWSER_NOTIFICATION };

// Signal changes on the subscribed namespace..
// @brief Initial HTML document has been completely loaded and parsed
// @param URL The URL that has been loaded
// @param code The response code of main resource request
virtual void LoadFinished(const string& URL, const int32_t code) = 0;
// @brief Browser failed to load page
// @param URL The URL that has been failed to load
virtual void LoadFailed(const string& URL) = 0;
// @brief Signals a URL change in the browser
// @param URL The URL that has been loaded or requested
// @param loaded loaded (true) or not (false)
virtual void URLChange(const string& URL, const bool loaded) = 0;
// @brief Signals a visibility change of the browser
// @param hidden hidden (true) or visible (false)
virtual void VisibilityChange(const bool hidden) = 0;
// @brief Notifies that the web page requests to close its window
virtual void PageClosure() = 0;
// @brief Base64 encoded JSON message from legacy $badger bridge
virtual void BridgeQuery(const string& message) = 0;
};

Expand All @@ -100,22 +112,41 @@ namespace Exchange {
// @param fps Current FPS
virtual uint32_t FPS(uint8_t& fps /* @out */) const = 0;

// @property
// @brief Headers to send on all requests that the browser makes
// @param header Header Name
virtual uint32_t Headers(string& header /* @out */) const = 0;
virtual uint32_t Headers(const string& header) = 0;

// @property
// @brief UserAgent string used by the browser
// @param useragent UserAgent value
virtual uint32_t UserAgent(string& ua /* @out */) const = 0;
virtual uint32_t UserAgent(const string& ua) = 0;

// @property
// @brief User preferred languages used by the browser
// @param language Preferred language
virtual uint32_t Languages(string& langs /* @out */) const = 0;
virtual uint32_t Languages(const string& langs) = 0;

// @property
// @brief Controls the local storage availability
// @param state enabled or disabled
virtual uint32_t LocalStorageEnabled(bool& enabled /* @out */) const = 0;
virtual uint32_t LocalStorageEnabled(const bool enabled) = 0;

// @property
// @brief HTTP cookies accept policy
// @param policy HTTP Cookie Accept Policy Type
virtual uint32_t HTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyType& policy /* @out */) const = 0;
virtual uint32_t HTTPCookieAcceptPolicy(const HTTPCookieAcceptPolicyType policy) = 0;

// @brief Response for legacy $badger.
// @param payload base64 encoded JSON string response to be delivered to $badger.callback(pid, success, json)
virtual uint32_t BridgeReply(const string& payload) = 0;
// @brief Send legacy $badger event.
// @param payload base64 encoded JSON string response to be delivered to window.$badger.event(handlerId, json)
virtual uint32_t BridgeEvent(const string& payload) = 0;

};
Expand Down
33 changes: 33 additions & 0 deletions interfaces/IConfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2020 RDK Management
*
* 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 WPEFramework {
namespace Exchange {

struct EXTERNAL IConfiguration : virtual public Core::IUnknown {
enum { ID = ID_CONFIGURATION };

virtual uint32_t Configure(PluginHost::IShell* framework) = 0;
};
}
}

46 changes: 46 additions & 0 deletions interfaces/IDIALServer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2021 RDK Management
*
* 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 WPEFramework {
namespace Exchange {

struct EXTERNAL IDIALServer : virtual public Core::IUnknown {

enum { ID = ID_DIALSERVER };

struct EXTERNAL IApplication : virtual public Core::IUnknown {

enum { ID = ID_DIALSERVER_APPLICATION };

virtual ~IApplication() = default;

virtual uint32_t AdditionalDataURL(string& url /* @out */) const = 0;

};

virtual ~IDIALServer() = default;

virtual IApplication* Application(const string& name) = 0;
};

}
}
Loading

0 comments on commit 2517a5a

Please sign in to comment.