0.0.1 • Published 5 years ago

@monoku/react-native-ios-aila v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

React Native Aila

A React Native wrapper for Aila's iOS SDK

Installation

npm install @monoku/react-native-ios-aila --save

Integration (before link step)

For use this module you'll need to get AILA's SDK, you can download it from https://files.ailatech.com/sharing/vzozvFguU

AILA's SDK provides a static library called (libPadlocScan.a) this library is necessary to make this module work.

Once you have downloaded AILA's SDK, you need to copy some files from the static folder inside of AILA's SDK to node_modules/@monoku/react-native-ios-aila/ios/AilaSDK/

The files you need to add to node_modules are:

  • libPadlocScan.a
  • PadlocScan.h
  • PadlocScan.podspec

to use libPadlocScan.a you must link again the following system frameworks:

  • AVFoundation.framework
  • Accelerate.framework
  • AudioToolbox.framework
  • CoreAudio.framework
  • CoreGraphics.framework
  • CoreMedia.framework
  • CoreVideo.framework
  • Foundation.framework
  • MediaPlayer.framework
  • UIKit.framework
  • libc++.tbd
  • libiconv.tbd

Link

react native link  @monoku/react-native-ios-aila

API

RNAila.initWithConfig

Initialize library (call this function once) and set initial config for scanningMode, motionDetectionMode, beepMode, cardDetectionMode, debugLevel; you can see an usage example below.

RNAila.startScanning

Turn on case/kiosk illumination and begin scanning.

RNAila.stopScanning

Turn off case/kiosk illumination and stop scanning.

RNAila.constants

scanningMode
  • auto -- Configure based on connected case
  • single -- Single-scan mode; stop upon successful scan
  • continuous -- Continuously scan
motionDetectionMode
  • off -- No motion detection; always scan
  • on -- Only scan when motion is detected
  • auto -- Configure based on connected case
beepMode
  • off -- Do not beep upon scan
  • on -- Automatically beep upon scan
cardDetectionMode
  • off -- Do not detect cards
  • on -- Detect cards
debugLevel

Debug logging level. Each level includes messages of equal or greater severity; for example, PadlocScanDebugLevelWarn also includes PadlocScanDebugLevelError messages.

  • Silent: PadlocScanDebugLevelSilent, no messages
  • Error: PadlocScanDebugLevelError, severe messages, likely fatal
  • Warn: PadlocScanDebugLevelWarn, problematic but not fatal
  • Info: PadlocScanDebugLevelInfo, messages for normal operations
  • Debug: PadlocScanDebugLevelDebug, internal messages
  • Bulk: PadlocScanDebugLevelBulk, low-level internal messages

Usage

import RNAila, { RNAilaEventsEmitter } from '@monoku/react-native-ios-aila';


// Create events listeners
RNAilaEventsEmitter.addListener('onDevConnectionDidChange', data => {
  console.log('isKioskConnected', data.isKioskConnected);
  console.log('isMobileCaseConnected', data.isMobileCaseConnected);
});

RNAilaEventsEmitter.addListener('onScan', (data) => {
  const {
    scanData: { type, code },
  } = data;
  
  console.log('type: ', type);
  console.log('scanCode: ', code);
  ...
});

RNAila.initWithConfig({
  scanningMode: RNAila.constants.scanningMode.auto,
  motionDetectionMode: RNAila.constants.motionDetectionMode.auto,
  beepMode: RNAila.constants.beepMode.on,
  cardDetectionMode: RNAila.constants.cardDetectionMode.off,
  debugLevel: RNAila.constants.debugLevel.warn
});

RNAila.startScanning();
\\ In this state you can scan 
RNAila.stopScanning();

Some of this information comes from the Aila usage kit.