<?xml version="1.0" encoding="utf-8"?>
<plugin
    xmlns="http://www.phonegap.com/ns/plugins/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    id="cordova-plugin-ble-vsp"
    version="1.2.4">

    <name>BLE VSP</name>
    <description>Laird Bluetooth Low Energy Virtual Serial Port Plugin</description>
    <license>Apache 2.0</license>
    <keywords>bluetooth, BLE, bluetooth low energy, bluetooth smart</keywords>

    <js-module src="www/ble.js" name="ble">
        <clobbers target="ble" />
    </js-module>

    <platform name="ios">

        <config-file target="config.xml" parent="/widget">
            <feature name="BLE">
                <param name="ios-package" value="BLECentralPlugin" onload="true"/>
            </feature>
        </config-file>

        <header-file src="src/ios/BLECentralPlugin.h" target-dir="BLECentralPlugin" />
        <source-file src="src/ios/BLECentralPlugin.m" target-dir="BLECentralPlugin" />

        <header-file src="src/ios/CBPeripheral+Extensions.h" target-dir="BLECentralPlugin" />
        <source-file src="src/ios/CBPeripheral+Extensions.m" target-dir="BLECentralPlugin" />

        <header-file src="src/ios/BLECommandContext.h" target-dir="BLECentralPlugin" />
        <source-file src="src/ios/BLECommandContext.m" target-dir="BLECentralPlugin" />

        <!-- frameworks -->
        <framework src="CoreBluetooth.framework" />

        <preference name="BLUETOOTH_USAGE_DESCRIPTION" default=" " />
        <config-file target="*-Info.plist" parent="NSBluetoothPeripheralUsageDescription">
            <string>$BLUETOOTH_USAGE_DESCRIPTION</string>
        </config-file>
    </platform>

    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/widget">
            <feature name="BLE">
                <param name="android-package" value="com.megster.cordova.ble.central.BLECentralPlugin"/>
            </feature>
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/manifest">
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
            <uses-permission android:name="android.permission.BLUETOOTH"/>
            <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
        </config-file>

        <source-file src="src/android/com/megster/cordova/ble/central" target-dir="src/com/megster/cordova/ble" />"
        <source-file src="src/android/com/eddbc" target-dir="src/com" />"
        <source-file src="src/android/com/lairdtech" target-dir="src/com" />"

    </platform>

    <platform name="browser">
        <js-module src="src/browser/BLECentralPlugin.js" name="BLECentralPlugin">
            <merges target="ble" />
        </js-module>
    </platform>
</plugin>
