service.cpp 721 B

1234567891011121314151617181920212223242526
  1. #define LOG_TAG "android.hardware.gnss@1.1-service.gpsd"
  2. #include <hidl/HidlSupport.h>
  3. #include <hidl/HidlTransportSupport.h>
  4. #include "Gnss.h"
  5. using ::android::hardware::configureRpcThreadpool;
  6. using ::android::hardware::gnss::V1_1::implementation::Gnss;
  7. using ::android::hardware::gnss::V1_1::IGnss;
  8. using ::android::hardware::joinRpcThreadpool;
  9. using ::android::OK;
  10. using ::android::sp;
  11. int main(int /* argc */, char* /* argv */ []) {
  12. sp<IGnss> gnss = new Gnss();
  13. configureRpcThreadpool(1, true /* will join */);
  14. if (gnss->registerAsService() != OK) {
  15. ALOGE("Could not register gnss 1.1 service.");
  16. return 1;
  17. }
  18. joinRpcThreadpool();
  19. ALOGE("Service exited!");
  20. return 1;
  21. }