npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vintel-plugin

v1.0.10

Published

Vintel package to work with cordova applications with BLE Central

Downloads

2

Readme

Installation

Simply install the plugin with following command

npm i vintel-plugin

The plugin has depecency on cordova-plugin-ble-central, which can be installed based on instructions mentioned in following repository https://github.com/don/cordova-plugin-ble-central

For the Cordova project you can install the plugin as given below (for more info, kindly check the plugin repository)

$ cordova plugin add cordova-plugin-ble-central --variable BLUETOOTH_USAGE_DESCRIPTION="Your description here" --variable IOS_INIT_ON_LOAD=true|false --variable BLUETOOTH_RESTORE_STATE=true|false --variable ACCESS_BACKGROUND_LOCATION=true|false

Methods

The plugin offers following Methods:

  1. init
  2. scan
  3. connect
  4. read
  5. write
  6. disconnect

Complete usage for the functions is given below

1. init

This function is used to initialize the plugin

.... // other package import
import vintel from "vintel-plugin"
....
const config = {
    mode: "prod", // or dev,
    apiKey: "{aws api key to make call}",
    aws: {
        region: '{aws-region}', // e.g. us-east-2
        credentials: {
          accessKeyId: '{aws-access-key-Id}',
          secretAccessKey: '{aws-secret-access-key}',
        },
      },
    returnConfig: true // default is false, if you need to see data received from AWS, set it true,
}

vintel.init(config);

2. scan

This method is used to scan and connect to avaialble Vintel BLE Modules e.g.

const scanConfig = {
  autoConnect: true, // or false
  seconds: 30, // default is 30, numeric value for duration to scan
  services: [], // array of services you want to search
}
vintel.scan(scanConfig, successCallback, errorCallback);
or
vintel.scan({}, successCallback, errorCallback);

function successCallback(response){
  console.log({response});
}

function errorCallback(error){
  console.log({error})
}

This plugin offers read, write and disconnect function as well but handled automatically by plugin for best pactices.

Events

This plugin offer events which can be used for to listening to various events. e.g.

// initialize
vintel.init(config);
// start listening
vintel.event.on("event", (event: any) => {
  switch (event.status) {
    case "Connected":
      console.log("event", event);
      break;
    case "AWSRequest":
      console.log("event", event);
      break;
    case "AWSResponse":
      console.log("event", event);
      break;
    case "Disconnected":
      console.log("event", event);
      break;
    case "OTA-Update":
      console.log("event", event);
      break;
    case "AWSError":
      console.log("event", event);
      break;
    default:
      break;
  }
});

Following events are avaialble

Status 	         |     Data	              |    Description
-------------------------------------------------------------
Scanning		                            Device is Scanning for Vintel Device
DeviceFound	                                    Device Object
ScanningStopped		                            Device had stopped scanning
Connected		                            Device Connected
Reading	                                            Data received on read	Data from the BLE service
Writing	            Response after writing data	    Data writing to BLE
AWSRequest	    Payload sent on AWS	Sending     Data to AWS
AWSResponse	    Received response from AWS 	    Response from AWS
AWSError	    Error received from AWS.	    Error while sending to AWS
OTAUpdate		                            Checking Update
OTA-uptodate		                            No update available
SendComplete		                            Sending instruction to device about completion
Disconnected		                            Device Disconnected
error		                                    Provides info about errors. Check the error codes for more info.

Following are error codes which are sent by plugin, in case of any error

Error Code    |      Message	                          |        Description
---------------------------------------------------------------------------------------------------------
C001	            No Internet!	                          There is not current internet connection. At this time, the device is required to have internet connection to upload to VINTEL cloud.
C002	            Bluetooth Not Enabled.	                  Bluetooth is not enabled The Bluetooth on the device is not enabled
C003	            Unable to connect to device.	          Unable to connect to the module Bluetooth detects VINTEL module but is unsuccessful connecting.
C004	            No Vintel Module/Device found.	          No module found to connect to. No VINTEL module detected.
C005	            Unable to enable Bluetooth Service.	          Unable to enable Bluetooth Bluetooth permission issue.
C006	            If Any non-generic error occurred. 	          Something went wrong Fallback.
C007	            Device scanning failed	                  Unable to scan for module.
C008	            Unable to read data from the device.	  Unable to read data from module.
C009	            Unable to write data to the device.	          Unable to append/write to module data.
C010	            Unable disconnect device.	                  Unable to disconnect from module.
C011	            Unable to send data to server.	          Unable to send data to VINTEL cloud.

For any issue of query, you can file bugs at: https://github.com/vinlogx/app-plugin-vintel/issues