All Projects → zssz → Berkanansdk

zssz / Berkanansdk

Licence: mit
Bluetooth mesh messaging SDK for apps

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Berkanansdk

Multipeer
📱📲 A wrapper for the MultipeerConnectivity framework for automatic offline data transmission between devices
Stars: ✭ 170 (+13.33%)
Mutual labels:  bluetooth, mesh-networks, offline
CombineCoreBluetooth
A wrapper API for CoreBluetooth using Combine Publishers
Stars: ✭ 50 (-66.67%)
Mutual labels:  tvos, watchos, bluetooth
Extendable
Blocks Based Bluetooth LE Connectivity framework for iOS/watchOS/tvOS/OSX. Quickly configure centrals & peripherals, perform read/write operations, and respond characteristic updates.
Stars: ✭ 88 (-41.33%)
Mutual labels:  bluetooth, tvos, watchos
Surmagic
🚀 The better way to deal with Binary Frameworks on iOS, Mac Catalyst, tvOS, macOS, and watchOS. Create XCFrameworks with ease.
Stars: ✭ 119 (-20.67%)
Mutual labels:  tvos, watchos
Mapbox Directions Swift
Traffic-aware directions and map matching in Swift on iOS, macOS, tvOS, watchOS, and Linux
Stars: ✭ 115 (-23.33%)
Mutual labels:  tvos, watchos
Mapboxgeocoder.swift
Address search and reverse geocoding in Swift or Objective-C on iOS, macOS, tvOS, and watchOS
Stars: ✭ 115 (-23.33%)
Mutual labels:  tvos, watchos
Swift Sdk
LeanCloud Swift SDK
Stars: ✭ 110 (-26.67%)
Mutual labels:  tvos, watchos
Iconic
🎨 Auto-generated icon font library for iOS, watchOS and tvOS
Stars: ✭ 1,567 (+944.67%)
Mutual labels:  tvos, watchos
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (-20.67%)
Mutual labels:  tvos, watchos
Noticeobservekit
NoticeObserveKit is type-safe NotificationCenter wrapper.
Stars: ✭ 147 (-2%)
Mutual labels:  tvos, watchos
Alley
Essential `URLSessionDataTask` micro-wrapper for communication with HTTP(S) web services, with built-in automatic request retries.
Stars: ✭ 137 (-8.67%)
Mutual labels:  tvos, watchos
Articles Zh Hans
Articles for NSHipster.cn
Stars: ✭ 113 (-24.67%)
Mutual labels:  tvos, watchos
Ios Samples
Xamarin.iOS sample apps
Stars: ✭ 1,501 (+900.67%)
Mutual labels:  tvos, watchos
Swiftui Kit
A SwiftUI system components and interactions demo app
Stars: ✭ 1,733 (+1055.33%)
Mutual labels:  tvos, watchos
Diff
Simple diff library in pure Swift
Stars: ✭ 110 (-26.67%)
Mutual labels:  tvos, watchos
Persistencekit
Store and retrieve Codable objects to various persistence layers, in a couple lines of code!
Stars: ✭ 121 (-19.33%)
Mutual labels:  tvos, watchos
Contentful.swift
A delightful Swift interface to Contentful's content delivery API.
Stars: ✭ 132 (-12%)
Mutual labels:  tvos, watchos
Swiftui Shapes
🚀 Collection of SwiftUI shapes
Stars: ✭ 137 (-8.67%)
Mutual labels:  tvos, watchos
Ducttape
📦 KeyPath dynamicMemberLookup based syntax sugar for Swift.
Stars: ✭ 138 (-8%)
Mutual labels:  tvos, watchos
Sniffer
Networking activity logger for Swift
Stars: ✭ 108 (-28%)
Mutual labels:  tvos, watchos

Berkanan SDK Tweet

build Contributions Contributor Covenant

Berkanan SDK enables Bluetooth mesh messaging between nearby apps. It's the framework used by Berkanan Messenger (Product Hunt, TechCrunch) and Berkanan Messenger Lite (GitHub).

The goal is to create a decentralized mesh network for the people, powered by their device's Bluetooth antenna. People could rely on this network for texting in situations, like emergencies, when there's no other connectivity available — it could literally save lives.

With Berkanan SDK, apps can discover nearby apps, which also have the SDK integrated and Bluetooth turned on, and send them small messages. The range for these messages is about 70 meters, but they can reach further because the SDK automatically resends them upon receiving. The more apps use Berkanan SDK, the further the reach of the messages gets.

Features and Limitations

  • Free and open-source: Contributions are welcome!
  • Bluetooth-powered: No need for Wi-Fi or cellular connectivity.
  • Background: On iOS, it works even while in the background. However, background-running apps can't discover each other — the system enforces this policy.
  • Connectionless communication with no pairing, no sessions, and no limit on the number of apps.
  • For sending messages, the SDK uses flooding, where duplicates are filtered by tracking their identifiers and decreasing their time to live (TTL) by 1, until they reach 0, as they travel from app to app.
  • The message range limit between two devices is about 70 meters.
  • The data size limit is 512 bytes.
  • No built-in support for encryption, acknowledgment, or store and forward. You have to roll your own if your use case requires it.
  • It's not a Bluetooth Mesh Networking implementation.
  • Supported operating systems: iOS 9.0 or later, watchOS 4.0 or later, tvOS 9.0 or later, macOS 10.13 or later.

Privacy Policy

Berkanan SDK does not send the messages to any central server or company.

Integrating Berkanan SDK into your app

iOS

To integrate Berkanan SDK into your iOS app, use Xcode 11 or later. Open the .xcodeproj or .xcworkspace file of your app and follow these steps.

Configuring your app target

Select your app target and then go to Editor / Add Capability / Background Modes. Check both Uses Bluetooth LE accessories and Acts as a Bluetooth LE accessory.

Go to Signing & Capabilities / App Sandbox and check the Bluetooth checkbox.

Add NSBluetoothAlwaysUsageDescription and NSBluetoothPeripheralUsageDescription to the Info.plist with the value:

Allow access to the Berkanan Bluetooth Service to be able to communicate even while offline.

Adding Berkanan SDK to your app

Go to File / Swift Packages / Add Package Dependency... and enter https://github.com/zssz/BerkananSDK.git

Add @import BerkananSDK to your source files where needed.

Using Berkanan SDK in your app

Initializing a local service with a configuration to advertise
let configuration = Configuration(
  // The identifier is used to identify what kind of configuration the service has. 
  // It should be the same across app runs.
  identifier: UUID(uuidString: "3749ED8E-DBA0-4095-822B-1DC61762CCF3")!, 
  userInfo: "My User Info".data(using: .utf8)!
)
// Throws if the configuration is too big or invalid.
let localService = try BerkananBluetoothService(configuration: configuration)
Starting a local service
localService.start()
Discovering nearby services and their advertised configuration
let discoverServiceCanceller = localService.discoverServiceSubject
  .receive(on: RunLoop.main)
  .sink { remoteService in
    print("Discovered \(remoteService) with \(remoteService.getConfiguration())")
}
Constructing a message with a payload type identifier and payload
let message = Message(
  // The payloadType is used to identify what kind of payload the message carries.
  payloadType: UUID(uuidString: "E268F3C1-5ADB-4412-BE04-F4A04F9B3D1A")!,
  payload: "Hello, World!".data(using: .utf8)
)
Sending a message
// Throws if the message is too big or invalid.
try localService.send(message)
Receiving messages
let receiveMessageCanceller = localService.receiveMessageSubject
  .receive(on: RunLoop.main)
  .sink { message in
    print("Received \(message.payloadType) \(message.payload)")
}
Stopping the local service
localService.stop()

Sample app

To see how Berkanan Messenger Lite app integrates Berkanan SDK, check out its source code.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].