Multiple plugin communication? (bluetooth)

android

#1

Hello,

I’m trying to connect to a fingerprint reader bluetooth device using nativescript, and I’m confused about what would be the best way to implement this.

First of all, I have some sample codes in native platforms (I will focus exclusively on Android) and I can see some of the classes have compiled functions from C files, so I understand I must make a plugin in order to be able to call these functions.

My confusion is about the use of the bluetooth plugin that already exists for nativescript: my plugin will need to maintain a Bluetooth connection, so I wonder what would be better between the following options:

  1. Create and use just one plugin which connects to the device and also use the fingerprint functions (use both things natively) or
  2. Create a plugin with just the fingerprint functions and call the nativescript bluetooth plugin (would it be possible to pass the bluetooth elements from one plugin to the other?)

Naturally, I’m trying to create the plugin writing the minimal possible code, so option one seems like repeating something already exists (even if I have the samples), but option two (if it would be possible) makes me wonder if I would need to make two bluetooth connections (one for each plugin).

Maybe there are other options, but these ones are what I thought for now. I’ll be looking for your answers.

kind regards.


#2

Since you have mentioned that you do have a native library that comes with the device, I think you should use that instead of depending on the existing bluetooth plugin for connection. There could be some protocol / strategies your native library might follow which we may not aware until we understand the whole library.