Skip to content

Scandit/blescannersdk-ios-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BLEScannerSDK Documentation

Installation

Prerequisites

Before you begin, ensure you have the following prerequisites:

  • The latest version of Xcode
  • An iOS project with a deployment target of iOS 14.0 or higher
  • A Scandit Express license key. Sign up for a free trial if you don't already have a license key.

Installation via Swift Package Manager (SPM)

To integrate the BLEScanner SDK into your Xcode project using Swift Package Manager, add the desired frameworks in the Package Dependencies section of your project.

Add our SPM package repository:

https://github.com/Scandit/blescanner-spm

Alternatively, if you prefer checking out git repositories via SSH:

[email protected]:Scandit/blescanner-spm.git

Installation via CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. To integrate the BLEScanner SDK into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'BLEScannerSDK'

Add the Framework Manually

You can download the framework from:

https://ssl.scandit.com/sdk/download/scandit-blescannersdk-ios-${VERSION}.zip

replacing ${VERSION} with the version you want to download.

Importing in Source Code

To use the SDK in your source code, import it as follows:

import BLEScannerSDK

Configuring the Host

You can use the WedgeHost initializer to set up a host:

WedgeHost(
    hostName: String,
    projectCode: String,
    baseUrl: String,
    eventCallback: (WedgeHostEvent) -> Void
)
  • hostName: The name you specify for the host.
  • projectCode: Your Scandit Express project code provided in the dashboard.
  • baseUrl: The base URL for the QR code that will be generated. You can use this to directly open your app by specifying a universal link. For example, if you want your host to redirect users to Scandit Express, you can specify https://express.scandit.com/bluetooth or scanditExpress://bluetooth.
  • eventCallback: The callback for events sent to the host (more details below).

The host can provide you with the connection QR code as a UIImage using:

host.makeQRCode().generateQRCode()

Receiving Events

Hosts receive events in the eventCallback. Here's how an event is defined:

public struct WedgeHostEvent {
    public let eventType: BLEScannerSDK.WedgeHostEventType
    public let data: String?
}
public enum WedgeHostEventType: Int {
    case NONE
    case ADV_STARTED // ADV stands for advertising Bluetooth services
    case ADV_STOPPED
    case ADV_ABORTED
    case DEVICE_NAME_SET
    case DEVICE_BARCODE_RECEIVED
    case DEVICE_DISCONNECTED
}

For example, when the host successfully receives a barcode, the WedgeHostEvent will look like this:

WedgeHostEvent(eventType: .DEVICE_BARCODE_RECEIVED, data: "barcode data")

Debugging the Host

Warning: You will need to run the host on a physical device since Bluetooth functionality does not work on the simulator.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages