Socket
Socket
Sign inDemoInstall

nativescript-lan-scan

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-lan-scan

NativeScript wrapper for iOS MMLanScan CocoaPod [BETA]


Version published
Weekly downloads
5
Maintainers
2
Weekly downloads
 
Created
Source

NativeScript LanScan [Beta]

(iOS Only)

Getting started

This plugin is a wrapper around the iOS MMLanScan library: https://github.com/mavris/MMLanScan

To use this plugin in a NativeScript app:

  1. Run: tns plugin add nativescript-lan-scan

What does it do?

This plugin will scan a local network and return an array of all detected IP and MAC addresses. See the original MMLanScan for more details.

How do you use it?

Add the plugin to your NativeScript app

tns plugin add nativescript-lan-scan

Include the plugin in your application. You will need to include a few of the event classes as well if you are using TypeScript - just so TypeScript is happy.

import { LanScan, FoundDeviceEventData, DeviceInfo, PingProgressEvent, PingProgress }

var lanScan = new LanScan();

// Wire up callback events from the Lan Scanner

// Fires whenever a devices is discovered
this._lanScan.on(LanScan.foundNewDeviceEvent, (args: FoundDeviceEventData) => {
    // Device info is found on the args.deviceInfo object...
    // args.deviceInfo.ipAddress
    // args.deviceInfo.macAddress
});

// Fires everytime an address on the subnet is pinged
this._lanScan.on(LanScan.progressPingedEvent, (args: PingProgressEventData) => {
    // args.pingProgress.overallHosts - total number hosts that the scanner will ping through
    // args.pingProgress.pingedHosts - current number of hosts that have been pinged
});

this._lanScan.on(LanScan.scanningFinishedEvent, (args) => {
    // Status: enum...
    // 0: Finished
    // 1: Stopped
});

// Start the Lan Scanner
lanScan.start();


// If, in the middle of the operation you want to stop the scan
lanScan.stop();

// Get the SSID
// Note that this doesn't work in the simulator,
// it will say "No Wifi Available"
let ssid = lanScan.fetchSSIDInfo();

Keywords

FAQs

Package last updated on 22 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc