Swiftpack.co - crownstone/bluenet-ios-lib as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by crownstone.
crownstone/bluenet-ios-lib 30.1.0
Crownstone lib for iOS written in Swift to interface with Crownstone devices that run the bluenet firmware.
⭐️ 5
🕓 1 year ago
iOS watchOS
.package(url: "https://github.com/crownstone/bluenet-ios-lib.git", from: "30.1.0")

Bluenet-lib-ios

Bluenet lib for iOS

Carthage compatible

Getting started

The Bluenet ios lib uses Carthage to handle it's dependencies. It's also the way you install Bluenet ios in other projects. If you're unfamiliar with Carthage, take a look at the project here: https://github.com/Carthage/Carthage

To get the Bluenet ios lib up and running, first you need to have Carthage installed. Then navigate to the project dir in which you want to include Bluenet ios and create a cartfile if one did not exist yet. (a cartfile is just a file, called "Cartfile" without extensions. Edit it in a text editor or XCode).

To add the dependency to the Cartfile, copy paste the lines below into it, save it and close it:

# BluenetLibIOS
github "crownstone/bluenet-ios-lib"

Once this is finished, run the following command in your terminal (in the same folder as the Cartfile)

carthage bootstrap --platform iOS --no-use-binaries

All dependencies will then be downloaded, built and placed in a Carthage/Build folder. You then drag the frameworks into your XCode project and you're good to go!

For more information on this process, take a look at the Carthage repo.

IMPORTANT

If you want to be able to receive location updates (iBeaconPackets or the room events) you NEED to add the "Location updates" to the "Background Modes" in the capabilities. Keep in mind that doing so may complicate the acceptance process in the App Store if you cannot prove that using the background location benefits the end user.

If you're more of a copy-paste starter

There is an example app available that has the library implemented: https://github.com/crownstone/bluenet-ios-example

Logging and Bluenet-ios-shared

For a clean split of modules, we have a core of shared data models and the logging class. This can be found here: https://github.com/crownstone/bluenet-ios-shared

The docs of the Logging are there as well. Log methods of bluenet-ios-lib can be called as shown below:

BluenetLib.LOG.<method>

// example: 
BluenetLib.LOG.setPrintLevel(level: .INFO)

API

This lib has two parts, the BLE one called Bluenet and the location one called BluenetLocalization. We use PromiseKit to handle all async events. If you see the return type is Promise that means this method is asynchronous and you'll have to use promises.

To use the lib, you will need to define a few of it's globals using the method below.

setBluenetGlobals(viewController: UIViewController, appName: String)

The viewcontroller is used to trigger the permission alerts and the appName is used in these alerts. The logging commands are for writing logs to file or logs to console. By default, console is enabled and to file is disabled.

Bluenet (BLE)

Read the docs here

BluenetLocalization (iBeacon and indoor localization)

Read the docs here

License

Open-source license

This software is provided under a noncontagious open-source license towards the open-source community. It's available under three open-source licenses:

  • License: LGPL v3+, Apache, MIT

License: LGPL v3 License: MIT License: Apache 2.0

Commercial license

This software can also be provided under a commercial license. If you are not an open-source developer or are not planning to release adaptations to the code under one or multiple of the mentioned licenses, contact us to obtain a commercial license.

  • License: Crownstone commercial license

Contact

For any question contact us at https://crownstone.rocks/contact/ or on our discord server through https://crownstone.rocks/forum/.

GitHub

link
Stars: 5
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics