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

Report list of supported data model names using RBUS method #218

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions sampleapps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ target_link_libraries(sample_rbus_session_mgr rbus)
install (TARGETS sample_rbus_session_mgr RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif (BUILD_SESSIONMGR_SAMPLE_APPS)

add_executable(sample_rbus_discover_elements consumer/sample_rbus_discover_elements.c)
add_dependencies(sample_rbus_discover_elements rbus)
target_link_libraries(sample_rbus_discover_elements rbus)
install (TARGETS sample_rbus_discover_elements RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

if (BUILD_FOR_DESKTOP)
add_executable(rbusBlockingConsumer consumer/rbusBlockingConsumer.c)
add_dependencies(rbusBlockingConsumer rbus)
Expand Down
92 changes: 92 additions & 0 deletions sampleapps/consumer/sample_rbus_discover_elements.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file
* the following copyright and licenses apply:
*
* Copyright 2016 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.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
#include <getopt.h>
#include <rbus.h>

static void asyncMethodHandler(
rbusHandle_t handle,
char const* methodName,
rbusError_t error,
rbusObject_t params)
{
(void)handle;

printf("asyncMethodHandler called: %s\n error=%d", methodName, error);
if(error == RBUS_ERROR_SUCCESS)
{
rbusObject_fwrite(params, 1, stdout);
}
}

int main(int argc, char *argv[])
{
rbusHandle_t handle;
rbusObject_t inParams;
rbusValue_t value;
int rc = RBUS_ERROR_SUCCESS;

(void)(argc);
(void)(argv);

printf("constumer: start\n");

rc = rbus_open(&handle, "Discover_Elements_Consumer");
if(rc != RBUS_ERROR_SUCCESS)
{
printf("consumer: rbus_open failed: %d\n", rc);
goto exit1;
}

rbusObject_Init(&inParams, NULL);

rbusValue_Init(&value);
rbusValue_SetString(value, "Device.");
rbusObject_SetValue(inParams, "topLevelPath", value);
rbusValue_Release(value);

rbusValue_Init(&value);
rbusValue_SetBoolean(value, true);
rbusObject_SetValue(inParams, "firstLevelOnly", value);
rbusObject_SetValue(inParams, "returnProperties", value);
rbusObject_SetValue(inParams, "returnMethods", value);
rbusObject_SetValue(inParams, "returnEvents", value);
rbusValue_Release(value);

rc = rbusMethod_InvokeAsync(handle, "Device.X_RDK-SupportedDM.DiscoverSupportedDM", inParams, asyncMethodHandler, 0);
rbusObject_Release(inParams);
printf("consumer: rbusMethod_InvokeAsync(Device.X_RDK-SupportedDM.DiscoverSupportedDM) %s\n",
rc == RBUS_ERROR_SUCCESS ? "success" : "fail");

sleep(5);

rbus_close(handle);

exit1:
printf("consumer: exit\n");
return rc;
}
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ IF (NOT BUILD_ONLY_RTMESSAGE)

if (BUILD_RBUS_DAEMON)
add_subdirectory(session_manager)
add_subdirectory(elements_discovery)
endif (BUILD_RBUS_DAEMON)

add_subdirectory(rbus)
Expand Down
11 changes: 11 additions & 0 deletions src/elements_discovery/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include_directories(.
../../include
../core
../rtmessage)

add_executable(disc_elements disc_elements.c)
add_dependencies(disc_elements rbus rbuscore)
target_link_libraries(disc_elements rbus rbuscore)

install (TARGETS disc_elements
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Loading
Loading