Code Monkey home page Code Monkey logo

hansemannn.ti.flic's Introduction

๐Ÿ”˜ Ti.Flic

Summary

Ti.Flic is an open-source project to support the Flic iOS-SDK in Appcelerator's Titanium Mobile.

Requirements

  • Titanium Mobile SDK 5.0.0.GA or later
  • iOS 7.0 or later
  • Xcode 7 or later

Setup

  • Optain your API key from the Flic Developer Console
  • Add the following background-modes to the plist-section of your tiapp.xml:
<key>UIBackgroundModes</key>
<array>
    <string>bluetooth-central</string>
</array>
  • Add the url-scheme of your app to the plist-section of your tiapp.xml:
<key>CFBundleURLTypes</key>
<array>
<dict>
    <key>CFBundleURLName</key>
    <string>com.company.yourappid</string>
    <key>CFBundleURLSchemes</key>
    <array>
        <!-- Please ensure that this identifier does not contain any special characters -->
        <string>yourAppURL</string>
    </array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>flic20</string>
</array>

Features

Methods

Name Arguments Return Type
configure args (Object: appID (String), appSecret (String), backgroundExecution (Boolean)
grabFlicFromFlicAppWithCallbackUrlScheme url (String)
enable
disable
onLocationChange
isEnabled Boolean
getButtonByUUID UUID (String) Object
connectButton UUID (String)
disconnectButton UUID (String)
forgetButton UUID (String)
indicateButtonLED UUID (String)
readButtonRSSI UUID (String)
updateButtonTriggerBehavior UUID (String), triggerBehavior (Number)
updateButtonLowLatencyMode UUID (String), enableLowLatency (Boolean)

Properties

Name Type
bluetoothState Number
knownButtons Array

Events

Name
didReceiveButtonDown
didReceiveButtonUp
didReceiveButtonClick
didReceiveButtonDoubleClick
didReceiveButtonHold
flicButtonDidConnect
flicButtonIsReady
didDisconnectWithError
didFailToConnectWithError
didUpdateRSSI
didGrabFlicButton
didChangeBluetoothState
didRestoreState
didForgetButton

Constants

Constant Property
BLUETOOTH_STATE_POWERED_ON bluetoothState
BLUETOOTH_STATE_POWERED_OFF bluetoothState
BLUETOOTH_STATE_RESETTING bluetoothState
BLUETOOTH_STATE_UNSUPPORTED bluetoothState
BLUETOOTH_STATE_UNAUTHORIZED bluetoothState
BLUETOOTH_STATE_UNKNOWN bluetoothState

The following constants are available in the knownButtons property and the events didDisconnectWithError, didFailToConnectWithError and didUpdateRSSI:

Constant Property
CONNECTION_STATE_CONNECTED connectionState
CONNECTION_STATE_CONNECTING connectionState
CONNECTION_STATE_DISCONNECTED connectionState
CONNECTION_STATE_DISCONNECTING connectionState
TRIGGER_BEHAVIOR_CLICK_AND_HOLD triggerBehavior
TRIGGER_BEHAVIOR_CLICK_AND_DOUBLE_CLICK triggerBehavior
TRIGGER_BEHAVIOR_CLICK_AND_DOUBLE_CLICK_AND_HOLD triggerBehavior

Example

Please check the /example/app.js for an example featuring all API's.

Author

Hans Knoechel (@hansemannnn / Web)

License

Apache 2.0

Contributing

Code contributions are greatly appreciated, please submit a new pull request!

hansemannn.ti.flic's People

Contributors

hansemannn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.