/wifilib

Primary LanguageJavaMIT LicenseMIT

wifilib

GitHub release GitHub packages jitpack docs sample license|MIT

English|Chinese

Add a dependency

implementation('com.selpic.sdk:wifilib:1.1.1@aar') { transitive = true }

Add contents for build.gradle in project root directory as follows:

allprojects {
    repositories {
        // https://github.com/TranscodeGroup/lib-module
        maven { url "https://jitpack.io" }
        // https://help.github.com/en/github/managing-packages-with-github-packages/configuring-gradle-for-use-with-github-packages
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/selpic-handy-printer/wifilib")
            credentials {
                // replace to yourself github account
                username = "github-packages-public-token"
                password = "40c403-bff7f614-9bd0a6-4fb87-0b2e2e45a672fda".replaceAll("-", "")
            }
        }
    }
}

Usages

Create global instance

val printer = SelpicPrinterFactory.create(appContext)

Get device information

printer.getDeviceInfo()
    .subscribe(
        { /*onSuccess*/ },
        { /*onError*/ }
    )

Set up print parameters

printer.setPrintParam(PrintParam(12, 1, 0))
    .subscribe(
        { /*onSuccess*/ },
        { /*onError*/ }
    )

Send print data

printer.sendPrintData(bitmap)
       .subscribe(
           { /*onNext*/  },
           { /*onError*/ }
       )

API documentation

API reference