Skip to content

henkkelder/cordova-airturn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cordova AirTurn

Cordova Plugin For AirTurn Device

Oktober 2023: Upgraded to Airturn framework 4.8.2 Fixed IOS program where IOS < 14 and IOS >= 14 behaved differntly.

Juli 2022: Upgraded to Airturn framework 4.6.1

April 2020: Upgraded to framework 3.7.4. Also UIWebView removed.

February 2019: Upgraded to framework 3.3.3.

January 2019: Upgraded to the Airturn framework 3.3.3-b.1 and switch to dynamic library

Oktober 2017: Upgraded to the Airturn framework 3.1.0 Beta2

IOS

Providing bridge to NotificationCenter

INSTALL

$ cordova create <PATH> [ID [NAME [CONFIG]]] [options]
$ cd <PATH>
$ cordova platform add ios
$ cordova plugin add https://github.com/mobilestar55555/cordova-airturn.git

USAGE:

From Native to Javascript

Javascript

onDeviceReady: function() {

    //app.receivedEvent('deviceready');

    var initAirTurn    = document.getElementById('initAirTurn'),
    addEvent = document.getElementById('addEvent'),
    setting = document.getElementById('setting');
    killApp = document.getElementById('killApp');

    window.airturn.initAirTurn(function( e ) {
        window.airturn.addAirTurnEventListener( "AirTurnConnectionStateNotification", function( e ) {
            var connectionState = "";

            if(e.AirTurnConnectionStateKey == 0)
                connectionState = "Unknown";
            else if(e.AirTurnConnectionStateKey == 1)
                connectionState = "Disconnect";
            else if(e.AirTurnConnectionStateKey == 2)
                connectionState = "Connecting";
            else if(e.AirTurnConnectionStateKey == 3)
            {
                connectionState = "Connected";
                window.airturn.getInfo( function( e ) {
                    console.log(e);
                    connectionState += "<br>PeripheralName:"+e.PeripheralName;
                    connectionState += "<br>DeviceUniqueIdentifier:"+e.DeviceUniqueIdentifier;
                    connectionState += "<br>FirmwareVersion:"+e.FirmwareVersion;
                    connectionState += "<br>HardwareVersion:"+e.HardwareVersion;
                    document.getElementById("airturn").innerHTML = "Connection State: "+connectionState;
                });
            }
            document.getElementById("airturn").innerHTML = "Connection State: "+connectionState;
        });

        window.airturn.addAirTurnEventListener( "AirTurnPedalPressNotification", function( e ) {
            document.getElementById("airturn").innerHTML = "Port Number: "+e.AirTurnPortNumberKey;
        });

        // use this after a text or other field has taken focus and the Presses are no longer triggered
        // maybe not needed since the framework tries to become firstResponder by itself.
        window.airturn.makeActive()

        window.airturn.isConnected(function( e ) {//AirTurnPedalPressNotification
            var connectionState = "";
            if(e)
                connectionState = 'Connected';
            else
                connectionState = 'Disconnected';

            document.getElementById("airturn").innerHTML = "Connection State: "+connectionState;
        });
    });


    setting.addEventListener('click', function() {
        window.airturn.setting( function( e ) {
        });
    });

    killApp.addEventListener('click', function() {
        window.airturn.killApp( function( e ) {
        });
    });

}

About

Cordova AirTurn Plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 99.5%
  • Other 0.5%