<?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-bluetooth-classic-serial-port"
    version="1.1.0">

    <name>Bluetooth Classic Serial</name>
    <description>Bluetooth Serial Communication Plugin</description>
    <license>Apache 2.0</license>
    <keywords>bluetooth, serial, classic, MFi, arduino</keywords>
    <repo>https://github.com/MaximBelov/cordova-plugin-bluetooth-classic-serial-port.git</repo>
    <issue>https://github.com/MaximBelov/cordova-plugin-bluetooth-classic-serial-port/issues</issue>

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

    <platform name="android">

        <config-file target="res/xml/config.xml" parent="/widget">
            <feature name="BluetoothClassicSerial">
                <param name="android-package" value="nz.co.soltius.cordova.BluetoothClassicSerial"/>
            </feature>
        </config-file>

        <source-file src="src/android/nz/co/soltius/cordova/BluetoothClassicSerial.java"
            target-dir="src/nz/co/soltius/cordova"/>
        <source-file src="src/android/nz/co/soltius/cordova/BluetoothClassicSerialService.java"
            target-dir="src/nz/co/soltius/cordova"/>

    </platform>

    <platform name="ios">
        <preference name="IOS_INIT_ON_LOAD" default="false"/>
        <preference name="BLUETOOTH_USAGE_DESCRIPTION" default="This app requires constant Bluetooth access to function properly."/>

        <config-file target="config.xml" parent="/widget">
            <feature name="BluetoothClassicSerial">
                <param name="ios-package" value="BluetoothClassicSerial" onload="$IOS_INIT_ON_LOAD"/>
            </feature>
        </config-file>

        <config-file target="*-Info.plist" parent="NSBluetoothPeripheralUsageDescription">
            <string>$BLUETOOTH_USAGE_DESCRIPTION</string>
        </config-file>
        <config-file target="*-Info.plist" parent="NSBluetoothAlwaysUsageDescription">
            <string>$BLUETOOTH_USAGE_DESCRIPTION</string>
        </config-file>

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

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

    </platform>

    <platform name="browser">
        <js-module src="src/browser/bluetoothClassicSerial.js" name="BluetoothSerial_browser">
            <clobbers target="window.bluetoothClassicSerial" />
        </js-module>

    </platform>
</plugin>
