-
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.
Merge pull request #132 from rdkcentral/next
feat: Support for C SDK generation
- Loading branch information
Showing
104 changed files
with
6,243 additions
and
315 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,18 @@ | ||
{ | ||
"name": "C", | ||
"langcode": "c", | ||
"createModuleDirectories": false, | ||
"extractSubSchemas": true, | ||
"templatesPerModule": [ | ||
"/include/module.h", | ||
"/src/module.cpp" | ||
], | ||
"templatesPerSchema": [ | ||
"/include/common/module.h", | ||
"/src/module_common.cpp", | ||
"/src/jsondata_module.h" | ||
], | ||
"persistPermission": true, | ||
"createPolymorphicMethods": true, | ||
"excludeDeclarations":true | ||
} |
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,19 @@ | ||
/* | ||
* Copyright 2021 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 | ||
*/ | ||
|
||
export { default as Transport } from './shared/Transport/index.mjs' |
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,56 @@ | ||
# 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 | ||
|
||
cmake_minimum_required(VERSION 3.3) | ||
|
||
project(Firebolt) | ||
|
||
set(FIREBOLT_TRANSPORT_WAITTIME 1000 CACHE STRING "Maximum time to wait for Transport layer to get response") | ||
set(FIREBOLT_LOGLEVEL "Info" CACHE STRING "Log level to be enabled") | ||
option(FIREBOLT_ENABLE_STATIC_LIB "Create Firebolt library as Static library" OFF) | ||
option(ENABLE_TESTS "Build openrpc native test" OFF) | ||
|
||
if (FIREBOLT_ENABLE_STATIC_LIB) | ||
set(FIREBOLT_LIBRARY_TYPE STATIC) | ||
else () | ||
set(FIREBOLT_LIBRARY_TYPE SHARED) | ||
endif () | ||
|
||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
set(CMAKE_INSTALL_PREFIX "${SYSROOT_PATH}/usr" CACHE INTERNAL "" FORCE) | ||
set(CMAKE_PREFIX_PATH ${SYSROOT_PATH}/usr/lib/cmake CACHE INTERNAL "" FORCE) | ||
endif() | ||
|
||
list(APPEND CMAKE_MODULE_PATH | ||
"${CMAKE_SOURCE_DIR}/cmake" | ||
"${SYSROOT_PATH}/usr/lib/cmake" | ||
"${SYSROOT_PATH}/tools/cmake") | ||
include(HelperFunctions) | ||
|
||
set(FIREBOLT_NAMESPACE ${PROJECT_NAME} CACHE STRING "Namespace of the project") | ||
|
||
find_package(WPEFramework CONFIG REQUIRED) | ||
|
||
add_subdirectory(src) | ||
|
||
if (ENABLE_TESTS) | ||
add_subdirectory(test) | ||
endif() | ||
|
||
# make sure others can make use cmake settings of Firebolt OpenRPC | ||
configure_file( "${CMAKE_SOURCE_DIR}/cmake/project.cmake.in" | ||
"${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}Config.cmake" | ||
@ONLY) |
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 | ||
|
||
macro(GetSubDirs subdirs currentdir) | ||
file(GLOB subdirectories RELATIVE ${currentdir} ${currentdir}/*) | ||
set(subdirs "") | ||
foreach(subdir ${subdirectories}) | ||
if (IS_DIRECTORY ${currentdir}/${subdir}) | ||
list(APPEND subdirs ${subdir}) | ||
endif() | ||
endforeach() | ||
endmacro() | ||
|
||
function(InstallHeaders) | ||
set(optionsArgs EXCLUDE_ROOT_DIR) | ||
set(oneValueArgs TARGET NAMESPACE SOURCE DESTINATION) | ||
set(multiValueArgs HEADERS) | ||
|
||
cmake_parse_arguments(Argument "${optionsArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) | ||
if (Argument_UNPARSED_ARGUMENTS) | ||
message(FATAL_ERROR "Unknown keywords given to InstallHeaders(): \"${Argument_UNPARSED_ARGUMENTS}\"") | ||
endif() | ||
if (Argument_HEADERS) | ||
add_custom_command( | ||
TARGET ${Argument_TARGET} | ||
POST_BUILD | ||
COMMENT "=================== Installing Headers ======================" | ||
) | ||
foreach(directory ${Argument_HEADERS}) | ||
if (Argument_EXCLUDE_ROOT_DIR) | ||
set(destination ${Argument_DESTINATION}) | ||
else() | ||
set(destination ${Argument_DESTINATION}/${directory}) | ||
endif() | ||
|
||
if (Argument_SOURCE) | ||
set(source ${Argument_SOURCE}) | ||
else() | ||
set(source ${CMAKE_CURRENT_LIST_DIR}) | ||
endif() | ||
|
||
GetSubDirs(subdirs ${source}/${directory}) | ||
list(APPEND subdirs ${directory}) | ||
|
||
foreach(subdir ${subdirs}) | ||
if (NOT subdir STREQUAL ".") | ||
set(dest ${destination}/${subdir}) | ||
file(GLOB headers "${source}/${directory}/${subdir}/*.h") | ||
if (headers) | ||
install( | ||
DIRECTORY "${source}/${directory}/${subdir}" | ||
DESTINATION include/${dest} | ||
FILES_MATCHING PATTERN "*.h") | ||
endif() | ||
endif() | ||
endforeach(subdir) | ||
endforeach(directory) | ||
endif() | ||
endfunction(InstallHeaders) |
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,35 @@ | ||
# 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 | ||
|
||
set(FIREBOLT_NAMESPACE "@FIREBOLT_NAMESPACE@" CACHE INTERNAL "" FORCE) | ||
set("${FIREBOLT_NAMESPACE}_FOUND" TRUE CACHE INTERNAL "" FORCE) | ||
|
||
list(APPEND CMAKE_MODULE_PATH | ||
"${CMAKE_SOURCE_DIR}/cmake" | ||
"${SYSROOT_PATH}/usr/lib/cmake" | ||
"${SYSROOT_PATH}/usr/lib/cmake/Firebolt" | ||
"${SYSROOT_PATH}/tools/cmake") | ||
|
||
if (NOT DEFINED CMAKE_PREFIX_PATH) | ||
set(CMAKE_PREFIX_PATH ${SYSROOT_PATH}/usr/lib/cmake CACHE INTERNAL "" FORCE) | ||
endif() | ||
|
||
if (FIREBOLT_ENABLE_STATIC_LIB) | ||
set(FIREBOLT_LIBRARY_TYPE STATIC) | ||
else () | ||
set(FIREBOLT_LIBRARY_TYPE SHARED) | ||
endif () | ||
|
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,41 @@ | ||
/* | ||
* 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 | ||
*/ | ||
|
||
#ifndef FIREBOLT_ERROR_H | ||
#define FIREBOLT_ERROR_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef enum FireboltSDKError { | ||
FireboltSDKErrorNone = 0, | ||
FireboltSDKErrorGeneral = 1, | ||
FireboltSDKErrorUnavailable = 2, | ||
FireboltSDKErrorTimedout = 3, | ||
FireboltSDKErrorNotSubscribed = 4, | ||
FireboltSDKErrorUnknown = 5, | ||
FireboltSDKErrorInUse = 6, | ||
FireboltSDKErrorNotSupported = 7 | ||
} FireboltSDKError_t; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // FIREBOLT_ERROR_H |
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,68 @@ | ||
/* | ||
* 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 | ||
*/ | ||
|
||
#ifndef FIREBOLT_H | ||
#define FIREBOLT_H | ||
|
||
#include "error.h" | ||
#include "types.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define IN | ||
#define OUT | ||
|
||
/** | ||
* @brief Intitialize the Firebolt SDK | ||
* | ||
* @param configLine JSON String with configuration options | ||
* | ||
* CONFIG Format: | ||
* { | ||
* "waitTime": 1000, | ||
* "logLevel": "Info", | ||
* "workerPool":{ | ||
* "queueSize": 8, | ||
* "threadCount": 3 | ||
* }, | ||
* "wsUrl": "ws://127.0.0.1:9998" | ||
* } | ||
* | ||
* | ||
* @return FireboltSDKErrorNone if success, appropriate error otherwise. | ||
* | ||
*/ | ||
uint32_t FireboltSDK_Initialize(char* configLine); | ||
|
||
|
||
/** | ||
* @brief Deintitialize the Firebolt SDK | ||
* | ||
* @return FireboltSDKErrorNone if success, appropriate error otherwise. | ||
* | ||
*/ | ||
uint32_t FireboltSDK_Deinitialize(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
|
||
#endif // FIREBOLT_H |
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,37 @@ | ||
/* | ||
* 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 | ||
*/ | ||
|
||
#ifndef FIREBOLT_TYPES_H | ||
#define FIREBOLT_TYPES_H | ||
|
||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef struct Firebolt_String_s* Firebolt_String_t; | ||
const char* Firebolt_String(Firebolt_String_t handle); | ||
void Firebolt_String_Release(Firebolt_String_t handle); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // FIREBOLT_TYPES_H |
Oops, something went wrong.