0

I have written a custom API to perform a specific task on top of bluez, now I want to provide the new API to UI app developer, I wandered to do so and failed to understand the flow of code from APP to bluez. Please anybody guide that how will be the flow from APP to bluez.

Do we have anything in chromium-OS like JNI as in android? I am having both chromium browser and OS source code.

sathish
  • 153
  • 1
  • 11
  • If you want to provide it inside a web page you need to [Insert code into the page context using a content script](//stackoverflow.com/a/9517879) – wOxxOm Mar 26 '18 at 05:39
  • No. I want to provide it for an APP. Here custom API is in C. – sathish Mar 26 '18 at 08:34
  • Since [nativeMessaging](https://developer.chrome.com/extensions/nativeMessaging) isn't availble in CrOS, I think you'll have to expose your API as a web service e.g. REST. – wOxxOm Mar 26 '18 at 08:39
  • ok. but some applications ex: bluetooth-scanner are calling a API (startDiscovery) which in turn calls the bluez API's (StartDiscovery) to discover the devices, then how they are communicating? – sathish Mar 26 '18 at 08:49
  • I don't know about bluez, but bluetooth-scanner app simply uses `chrome.bluetooth` API as you can see in its source code. – wOxxOm Mar 26 '18 at 08:54
  • please correct me if i'm wrong, here chrome.bluetooth is a package, we can call the api's present in this package.if it is correct then how can we add the C api's to that package. I have seen that the API in C is different from the calling API in bluetooth scanner APP. – sathish Mar 26 '18 at 09:02
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/167542/discussion-between-sathish-and-woxxom). – sathish Mar 26 '18 at 09:05
  • [chrome.bluetooth](https://developer.chrome.com/apps/bluetooth) is a built-in API. There are no packages in apps/extensions environment. I suggest reading a tutorial or introduction on chrome apps. – wOxxOm Mar 26 '18 at 09:20
  • I understood that chrome.bluetooth is an API which supports many methods. Is it possible to add a method to that? If so how? – sathish Mar 26 '18 at 09:27
  • There's no way to extend the built-in API externally. The only methods are nativeMessaging (not available in CrOS) or a RESTful web server and such. – wOxxOm Mar 26 '18 at 09:31
  • Thanks for good guidance. I have understood it. But when i'm searching for these i crossed Binder Mojo. What is that? I though it is like JNI as in android. – sathish Mar 26 '18 at 09:48
  • [Mojo](https://www.chromium.org/developers/design-documents/mojo/mojo-migration-guide) is an internal IPC system, it doesn't have an API for apps/extensions. – wOxxOm Mar 26 '18 at 09:50
  • but CrOS has dbus as IPC. What is use of using Mojo in Cros? I found that the APP calling method (startDiscovery) is different from the actuall method (StartDiscovery), where this translation is happening. Is it through Mojo? – sathish Mar 26 '18 at 09:58
  • Apps/extensions can use only what is exposed via chrome.* API. Since IPC is not exposed it cannot be used. – wOxxOm Mar 26 '18 at 09:59

0 Answers0