npm package: @monoku/react-native-ios-aila
Description: Aila SDK iOS library for React Native
Author: @monoku-admin
Latest version: 0.0.1
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# React Native Aila
A React Native wrapper for [Aila's iOS SDK](https://ailatech.com/)

## Installation
```sh
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
```sh
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
```javascript
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.