#include <binder/ProcessState.h> #include <binder/IServiceManager.h> #include <binder/Binder.h> #include <binder/IPCThreadState.h> #include <utils/String16.h> #include "ILedService.h" #include "Led.h" using namespace android; int main() { sp<ProcessState> proc(ProcessState::self()); sp<IServiceManager> sm(defaultServiceManager()); sp<IBinder> binder = sm->getService( String16("led.service") ); sp<ILedService> led = interface_cast<ILedService>( binder ); sp<ILedClient> client = new Led; led->connect( client ); IPCThreadState::self()->joinThreadPool(); return 0; }