Git Product home page Git Product logo

eddystone-ios's Introduction

Eddystone CocoaPod

[CI Status](https://travis-ci.org/Tanner Nelson/Eddystone) Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Nearby

To fetch nearby Eddystone objects, simply start the scanner

Eddystone.Scanner.start(self)

Then get an array of the nearby objects

Eddystone.Scanner.nearby

To start the scanner, you will need to provide an Eddystone.ScannerDelegate delegate that will be notified to changes in the nearby objects

public protocol ScannerDelegate {
    func eddystoneNearbyDidChange()
}

Objects of the Eddystone.Generic class returned by Eddystone.Scanner.nearby have several properties gathered from the three Eddystone frame types and basic beacon information.

Beacon

public var signalStrength: Beacon.SignalStrength
public var identifier: String

Eddystone-URL

public var url: NSURL?

Eddystone-UID

public var namespace: String?
public var instance: String?
public var uid: String?

Eddystone-TLM

public var battery: Double?
public var temperature: Double?
public var advertisementCount: Int?
public var onTime: NSTimeInterval?

URL or UID Specific Applications

Since Eddystone beacons may broadcast one or more of the frame types, most of the properties on the Eddystone.Generic class are optionals. If your application is dealing exlusively with Eddystone-URL or Eddystone-UID frame types, you may use the following Eddystone.Scanner properties instead.

Notice the objects returned by these methods have properties that are not optionals.

Url

Get an array of Eddystone.Url objects with

Eddystone.Scanner.nearbyUrls

Eddystone.Url objects have the following properties

public var signalStrength: Beacon.SignalStrength
public var identifier: String
public var url: NSURL

Uid

Get an array of Eddystone.Uid objects with

Eddystone.Scanner.nearbyUids

Eddystone.Uid objects have the following properties

public var signalStrength: Beacon.SignalStrength
public var identifier: String
public var namespace: String
public var instance: String
public var uid: String

##Debugging

Logs from the Eddystone module may be helpful while debugging your application. To enable logs, use the following line.

Eddystone.logging = true

Additional Resources

UITableViewExtensions.swift

As Eddystone beacons become closer or farther away from the device, they will need to be re-arranged on screen. The following gist makes re-arranging the data source for your UITableView much easier.

ExampleViewController: UIViewController, Eddystone.ScannerDelegate {
    var urls = Eddystone.Scanner.nearbyUrls
    var previousUrls: [Eddystone.Url] = []

    func eddystoneNearbyDidChange() {
        self.previousUrls = self.urls
        self.urls = Eddystone.Scanner.nearbyUrls

        self.mainTableView.switchDataSourceFrom(self.previousUrls, to: self.urls, withAnimation: .Top)
    }    
}

https://gist.github.com/tannernelson/6d140c5ce2a701e4b710

SignalStrength

Showing the relative signal strength for an Eddystone object helps the user understand how close they are to the beacon. This cocoapod provides you with an iOS 7 style Signal Strength view that you can put anywhere in your application.

https://cocoapods.org/pods/SignalStrength

Requirements

Eddystone uses CoreBluetooth

Installation

Eddystone is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Eddystone"

Examples

The Eddystone cocoapod comes with an example iOS project that shows how the various method calls work in a real application. The example application also includes the aforementioned Additional Resources.

Author

Tanner Nelson, [email protected]

License

Eddystone is available under the MIT license. See the LICENSE file for more info.

eddystone-ios's People

Contributors

southfox avatar tanner0101 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.