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

PoC: Interface for Firebolt Privacy Module #332

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
94 changes: 94 additions & 0 deletions interfaces/IFireboltDiscovery.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2024 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"

// @insert <com/IIteratorType.h>

namespace WPEFramework {

namespace Exchange {


struct EXTERNAL IFireboltDiscovery : virtual public Core::IUnknown {

enum { ID = ID_FIREBOLT_DISCOVERY };
struct EXTERNAL DiscoveryPolicy{
bool enableRecommendation;
bool shareWatchHistory;
bool rememberWatchedProgram;
};

// @event
struct EXTERNAL INotification : virtual public Core::IUnknown {
enum { ID = ID_FIREBOLT_DISCOVERY_NOTIFICATION };
~INotification() override = default;

// @brief Notifies that PolicyValue Changed
/* @text:onPolicyChanged */
virtual void OnPolicyChanged(const struct DiscoveryPolicy policy) = 0;
};

// Pushing notifications to interested sinks
virtual Core::hresult Register(IFireboltDiscovery::INotification* sink) = 0;
virtual Core::hresult Unregister(IFireboltDiscovery::INotification* sink) = 0;

// @brief Provides Current Policy in action
virtual Core::hresult GetDiscoveryPolicy(DiscoveryPolicy& policy /* @out */) = 0;

virtual Core::hresult watched(const string& appId) = 0;
};

namespace JSONRPC {

/* @json 1.0.0 */
struct EXTERNAL IFireboltDiscoveryJSONRPC {

virtual ~IFireboltDiscoveryJSONRPC() = default;


/* @event */
struct EXTERNAL INotification {

virtual ~INotification() = default;

// @brief Notifies change in the discovery policy
virtual void PolicyChanged(const IFireboltDiscovery::DiscoveryPolicy policy) = 0;
};
// @text SignIn
// @brief Signin the user in the app
// @details AppID shall be passed through the security token.
// @param signin: True - SignIn
// @retval ERROR_PRIVILIGED_REQUEST: App security errors
virtual Core::hresult SignIn(const Core::JSONRPC::Context& context, const bool signin /*@optional*/) = 0;

// @text Policy
// @brief Signin the user in the app
// @details Get the current Discovery Policy
// @retval ERROR_PRIVILIGED_REQUEST: App security errors
virtual Core::hresult Policy(const Core::JSONRPC::Context& context, IFireboltDiscovery::DiscoveryPolicy& policy /*@out*/) = 0;

};

} // namespace JSONRPC

} // namespace Exchange

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

/* @json 1.0.0*/
struct EXTERNAL IFireboltPrivacy : virtual public Core::IUnknown {
enum { ID = ID_FIREBOLT_PRIVACY };

// @event
struct EXTERNAL INotification : virtual public Core::IUnknown {
enum { ID = ID_FIREBOLT_PRIVACY_NOTIFICATION };
~INotification() override = default;

// @brief Notifies that Allow Resume points value change
/* @text:onAllowResumePointsChanged */
virtual void OnAllowResumePointsChanged(const bool value) = 0;
// @brief Notifies that Allow personalization value change
/* @text:onAllowPersonalizationChanged */
virtual void OnAllowPersonalizationChanged(const bool value) = 0;
// @brief Notifies that Allow Watch History value change
/* @text:onAllowWatchHistoryChanged */
virtual void OnAllowWatchHistoryChanged(const bool value) = 0;
};

~IFireboltPrivacy() override = default;

// Pushing notifications to interested sinks
virtual Core::hresult Register(IFireboltPrivacy::INotification* sink) = 0;
virtual Core::hresult Unregister(IFireboltPrivacy::INotification* sink) = 0;

// @brief Provides Current resume watch status
// @text:AllowResumePoints
virtual Core::hresult GetAllowResumePoints(bool& allow /* @out */) const = 0;
// @brief sets the current resume watch status
// @text:SetAllowResumePoints
virtual Core::hresult SetAllowResumePoints(const bool& value ) = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oke to create both methods (i.s.o. properties) but please keep it consistent. Or both are prefixed with Get and Set or both are not prefixed (so no Get/Set in front of it).

// @brief Provides Current resume watch status
// @text:AllowPersonalization
virtual Core::hresult GetAllowPersonalization(bool& allow /* @out */) const = 0;
// @brief sets the current resume watch status
// @text:SetAllowPersonalization
virtual Core::hresult SetAllowPersonalization(const bool& value ) = 0;
// @brief Provides Current resume watch status
// @text:AllowWatchHistory
virtual Core::hresult GetAllowWatchHistory(bool& allow /* @out */) const = 0;
// @brief sets the current resume watch status
// @text:SetAllowWatchHistory
virtual Core::hresult SetAllowWatchHistory(const bool& value ) = 0;

};
}
}
9 changes: 8 additions & 1 deletion interfaces/Ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,14 @@ namespace Exchange {

ID_DNS_SERVER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4E0,
ID_DNS_ZONE = ID_DNS_SERVER + 1,
ID_DNS_RECORD = ID_DNS_SERVER + 2
ID_DNS_RECORD = ID_DNS_SERVER + 2,

ID_FIREBOLT_PRIVACY = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4F0,
ID_FIREBOLT_PRIVACY_NOTIFICATION = ID_FIREBOLT_PRIVACY + 1,

ID_FIREBOLT_DISCOVERY = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x500,
ID_FIREBOLT_DISCOVERY_NOTIFICATION = ID_FIREBOLT_DISCOVERY + 1,
ID_FIREBOLT_DISCOVERY_POLICY = ID_FIREBOLT_DISCOVERY + 2
};
}
}