You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an issue with my proxy setup where isAvailable() always returns false despite the stub being up and running. Below is the setup code for the consumer proxy:
void ConsumerCapiProxy::setup() {
int count = 1;
InfoLog("ConsumerCapiProxy setup");
// Get the CommonAPI runtime
std::shared_ptr<CommonAPI::Runtime> runtime1 = CommonAPI::Runtime::get();
if (runtime1 != nullptr) {
// Attempt to build the proxy
consumerProxy = runtime1->buildProxy<v1::wrapper::ConsumerProxy>(
"local", "wrapper.Consumer");
if (consumerProxy != nullptr) {
// Subscribe to proxy status events
consumerProxy->getProxyStatusEvent().subscribe(onProxyStatusEvent);
// Poll until proxy becomes available
while (!consumerProxy->isAvailable()) {
printf("Trail: %d ConsumerProxy service unavailable, retrying\n", count);
++count;
usleep(100000); // Sleep for 100ms (adjust as needed)
}
// Proxy is available, update status flag
bConsumerProxyAvailable.store(true);
// Subscribe to specific events or perform other actions upon successful setup
if (bConsumerProxyAvailable.load()) {
consumerProxy_subscribeEventValue();
} else {
ErrorLog("Consumer_WrapperProxy buildProxy failed.");
}
} else {
ErrorLog("ConsumerCapiProxy: CommonAPI Runtime cannot be null");
}
}
<<<
and here is the Stub code:
<<<
void ConsumerCapiStub::serviceStart() {
bool serviceRegistered = false;
DLT_LOG(CRCC, DLT_LOG_INFO, DLT_STRING("ConsumerCapiStub() setup"));
std::shared_ptrCommonAPI::Runtime runtime1 = CommonAPI::Runtime::get();
if (runtime1 != nullptr) {
DLT_LOG(CRCC, DLT_LOG_INFO, DLT_STRING("Success to initialize CommonAPI runtime."));
if(nullptr == consumerStub.get()) {
std::shared_ptr consumerStub = std::make_shared();
DLT_LOG(CRCC, DLT_LOG_INFO, DLT_STRING("Allocate consumerStub"));
}
if(nullptr != consumerStub.get()) {
serviceRegistered = runtime1->registerService("local", "wrapper.Consumer", consumerStub);
if(serviceRegistered) {
DLT_LOG(CRCC, DLT_LOG_INFO, DLT_STRING("Registration Success: ConsumerapiInterface() connected to server"));
}
else
DLT_LOG(CRCC, DLT_LOG_ERROR, DLT_STRING("register error"));
} else
DLT_LOG(CRCC, DLT_LOG_ERROR, DLT_STRING("consumerStub is nullptr"));
}
else
DLT_LOG(CRCC, DLT_LOG_ERROR, DLT_STRING("Failed to initialize CommonAPI runtime."));
}
I've confirmed that the serviceID and InstanceID are correctly provided from the FIDL files. Despite successful registration, the connection between the proxy and stub is not established. Could you please assist in diagnosing potential issues that might be causing the proxy service to remain unavailable? What files I need to check (for ex: .fidl, .fdepl, .ini or binding code and skeleton code) to understand where the issue is happening ?
Your insights and assistance would be greatly appreciated. Thank you!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello everyone,
I'm encountering an issue with my proxy setup where isAvailable() always returns false despite the stub being up and running. Below is the setup code for the consumer proxy:
void ConsumerCapiProxy::setup() {
int count = 1;
InfoLog("ConsumerCapiProxy setup");
}
<<<
and here is the Stub code:
<<<
void ConsumerCapiStub::serviceStart() {
bool serviceRegistered = false;
DLT_LOG(CRCC, DLT_LOG_INFO, DLT_STRING("ConsumerCapiStub() setup"));
std::shared_ptrCommonAPI::Runtime runtime1 = CommonAPI::Runtime::get();
if (runtime1 != nullptr) {
DLT_LOG(CRCC, DLT_LOG_INFO, DLT_STRING("Success to initialize CommonAPI runtime."));
if(nullptr == consumerStub.get()) {
std::shared_ptr consumerStub = std::make_shared();
DLT_LOG(CRCC, DLT_LOG_INFO, DLT_STRING("Allocate consumerStub"));
}
if(nullptr != consumerStub.get()) {
serviceRegistered = runtime1->registerService("local", "wrapper.Consumer", consumerStub);
if(serviceRegistered) {
DLT_LOG(CRCC, DLT_LOG_INFO, DLT_STRING("Registration Success: ConsumerapiInterface() connected to server"));
}
else
DLT_LOG(CRCC, DLT_LOG_ERROR, DLT_STRING("register error"));
} else
DLT_LOG(CRCC, DLT_LOG_ERROR, DLT_STRING("consumerStub is nullptr"));
}
else
DLT_LOG(CRCC, DLT_LOG_ERROR, DLT_STRING("Failed to initialize CommonAPI runtime."));
}
I've confirmed that the serviceID and InstanceID are correctly provided from the FIDL files. Despite successful registration, the connection between the proxy and stub is not established. Could you please assist in diagnosing potential issues that might be causing the proxy service to remain unavailable? What files I need to check (for ex: .fidl, .fdepl, .ini or binding code and skeleton code) to understand where the issue is happening ?
Your insights and assistance would be greatly appreciated. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions