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

connman-simplified

v0.1.3

Published

Node.js package that simplifies Connman (Opensource connection manager) usage. Uses connman-api.

Downloads

5

Readme

Connman simplified

Node.js package that simplifies Connman (Opensource connection manager) usage. Enables you to easilly control connections over wifi and ethernet. Get realtime status changes. Uses Connman-api package internally. Connman: http://www.connman.net/

  • Abstracts Connman API making your code shorter and simpler.
  • Includes network cache system (for when scanning is impossible in hotspot mode).
  • Uses regular Node.js naming conventions.

Examples

Try to connect to favorite wifi network, if fails become hotspot. Log the wifi state changes.

var connman = require('connman-simplified')();
connman.init(function(err) {
  connman.initWiFi(function(err,wifi,properties) {
  
    if(!properties.connected) { // not yet connected? 
      wifi.joinFavorite(function(err) {
        if(err) wifi.openHotspot();
      });
    }
    wifi.on('state',function(value) {
      console.log("WiFi state change: ",value);
    });
    
  });
});

Join specific network, disconnect after 5 seconds.

var connman = require('connman-simplified')();
connman.init(function(err) {
  connman.initWiFi(function(err,wifi,properties) {
  
    wifi.join("myhomenetwork",'myPassphrase');
    
    setTimeout(function() {
      wifi.disconnect();
    },5000);
    
  });
});

Open a hotspot, get cached available networks, close after 5 seconds, get fresh available networks. Retrieving networks from cache is usefull because usually hardware can't scan while being hotspot.

var connman = require('connman-simplified')();
connman.init(function(err) {
  connman.initWiFi(function(err,wifi,properties) {
    
    wifi.openHotspot("myhotspot","aPassphrase",function(err) {
      // get cached available networks (collected earlier)
      wifi.getNetworksCache(function(err,list) {
        console.log("networks from cache: ",list);
      });
      
      setTimeout(function() {
        wifi.closeHotspot(function(err) {
          // get fresh available networks
          wifi.getNetworks(function(err,list) {
            console.log("networks: ",list);
          });
        });
      },5000);
    });
    
  });
});

Get a more readable networks list. Uses common Connman services format, see: https://01.org/connman/documentation

var connman = require('connman-simplified')();
connman.init(function(err) {
  connman.initWiFi(function(err,wifi,properties) {
    
    wifi.getNetworks(function(err,list) {
      // get more readable list using getServicesString:
      console.log("networks: ",wifi.getServicesString(list));
    });
    
  });
});

Bigger interactive example is included.

Debugging

Uses Debug package, to see all logs run:

$export DEBUG=*

License

Licensed under the MIT License

Author

Peter Uithoven @ Doodle3D