-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implementation of bi-directional communication with platform
Bidirectional is disabled by default. Can be in cmake: 'ENABLE_BIDRECTIONAL'. UTs were executed with undefined UNIT_TEST. SOME TESTS FAILED: Test SubscribeDiscoveryOnNavigateToLaunchNotification failed: SubscribeDiscoveryOnNavigateToLaunchNotification failed. Error: 1
- Loading branch information
1 parent
36347e2
commit 432e68a
Showing
17 changed files
with
961 additions
and
470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2023 Comcast Cable Communications Management, LLC | ||
* | ||
* 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. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#include "Event.h" | ||
|
||
namespace FireboltSDK { | ||
|
||
Event* Event::_singleton = nullptr; | ||
|
||
/* static */ Event& Event::Instance() | ||
{ | ||
static Event *instance = new Event(); | ||
ASSERT(instance != nullptr); | ||
return *instance; | ||
} | ||
|
||
/* static */ void Event::Dispose() | ||
{ | ||
ASSERT(_singleton != nullptr); | ||
|
||
if (_singleton != nullptr) { | ||
delete _singleton; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright 2023 Comcast Cable Communications Management, LLC | ||
* | ||
* 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. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#pragma once | ||
|
||
#include "Module.h" | ||
#include "Gateway/Gateway.h" | ||
|
||
namespace FireboltSDK { | ||
|
||
class Event { | ||
private: | ||
static Event* _singleton; | ||
|
||
private: | ||
Event() | ||
{ | ||
ASSERT(_singleton == nullptr); | ||
_singleton = this; | ||
} | ||
|
||
public: | ||
virtual ~Event() | ||
{ | ||
_singleton = nullptr; | ||
} | ||
|
||
static Event& Instance(); | ||
static void Dispose(); | ||
void Configure(Transport<WPEFramework::Core::JSON::IElement>* transport) {} | ||
|
||
public: | ||
template <typename RESULT, typename CALLBACK> | ||
Firebolt::Error Subscribe(const string& eventName, const CALLBACK& callback, void* usercb, const void* userdata) | ||
{ | ||
JsonObject jsonParameters; | ||
return Subscribe<RESULT, CALLBACK>(eventName, jsonParameters, callback, usercb, userdata); | ||
} | ||
|
||
template <typename RESULT, typename CALLBACK> | ||
Firebolt::Error Subscribe(const string& eventName, JsonObject& jsonParameters, const CALLBACK& callback, void* usercb, const void* userdata, bool prioritize = false) | ||
{ | ||
return Gateway::Instance().Subscribe<RESULT>(eventName, jsonParameters, callback, usercb, userdata, prioritize); | ||
} | ||
|
||
Firebolt::Error Unsubscribe(const string& eventName, void* usercb) | ||
{ | ||
return Gateway::Instance().Unsubscribe(eventName); | ||
} | ||
|
||
template <typename RESULT, typename CALLBACK> | ||
Firebolt::Error Prioritize(const string& eventName,JsonObject& jsonParameters, const CALLBACK& callback, void* usercb, const void* userdata) | ||
{ | ||
Firebolt::Error status = Firebolt::Error::General; | ||
return status; | ||
} | ||
}; | ||
} |
File renamed without changes.
Oops, something went wrong.