refactor: 重构项目 (#3)

This commit is contained in:
iAMD
2022-09-23 10:28:33 +08:00
committed by GitHub
parent 81a6f4528b
commit 9ec2449694
160 changed files with 16034 additions and 26183 deletions

29
.gitignore vendored
View File

@ -1,7 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
.pub/
build/

View File

@ -1,19 +0,0 @@
<component name="libraryTable">
<library name="Dart SDK">
<CLASSES>
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/async" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/core" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/html" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/io" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/math" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file://C:\Tools\flutter/bin/cache/dart-sdk/lib/typed_data" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

10
.idea/modules.xml generated
View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/bluetooth_low_energy.iml" filepath="$PROJECT_DIR$/bluetooth_low_energy.iml" />
<module fileurl="file://$PROJECT_DIR$/android/bluetooth_low_energy_android.iml" filepath="$PROJECT_DIR$/android/bluetooth_low_energy_android.iml" />
<module fileurl="file://$PROJECT_DIR$/example/android/bluetooth_low_energy_example_android.iml" filepath="$PROJECT_DIR$/example/android/bluetooth_low_energy_example_android.iml" />
</modules>
</component>
</project>

View File

@ -1,6 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="example/lib/main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/example/lib/main.dart" />
<method />
</configuration>
</component>

45
.idea/workspace.xml generated
View File

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="bluetooth_low_energy.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/bluetooth_low_energy.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="ToolWindowManager">
<editor active="true" />
<layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
</layout>
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
</navigator>
<panes>
<pane id="ProjectPane">
<option name="show-excluded-files" value="false" />
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="dart.analysis.tool.window.force.activate" value="true" />
<property name="show.migrate.to.gradle.popup" value="false" />
</component>
</project>

View File

@ -1,10 +1,33 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
# This file should be version controlled.
version:
revision: 02c026b03cd31dd3f867e5faeb7e104cce174c5f
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
channel: stable
project_type: plugin
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
- platform: android
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
- platform: ios
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

View File

@ -1,3 +1,8 @@
## 1.0.0
- Upgrade to flutter 3.x.
- Rewrite the whole project with pigeon.
## 0.1.0
- Add implementations on iOS.

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 yanshouwang
Copyright (c) 2022 yanshouwang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,12 +1,12 @@
# Bluetooth Low Energy
# bluetooth_low_energy
A bluetooth low energy plugin for flutter, which can be used to develope central role apps.
## Features
### Central APIs
- [x] Discover advertisements.
- [x] Connect/Disconnect to GATTs.
- [x] Scan advertisements.
- [x] Connect/Disconnect to peripherals.
- [x] Read/Write/Notify characteristics.
- [x] Read/Write descriptors.

View File

@ -1 +1,18 @@
include: package:pedantic/analysis_options.yaml
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.pb.dart"
- "**/*.pbenum.dart"
- "**/*.pbjson.dart"
- "**/*.pbserver.dart"
- "**/*.mocks.dart"
linter:
rules:
prefer_single_quotes: true
require_trailing_commas: true

1
android/.gitignore vendored
View File

@ -6,3 +6,4 @@
.DS_Store
/build
/captures
.cxx

View File

@ -2,15 +2,14 @@ group 'dev.yanshouwang.bluetooth_low_energy'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.5.21'
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
maven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@ -19,7 +18,6 @@ rootProject.allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/' }
}
}
@ -27,11 +25,21 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 30
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion 21
}
@ -39,5 +47,6 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.protobuf:protobuf-kotlin:3.17.3'
implementation 'com.google.protobuf:protobuf-kotlin:3.19.4'
implementation 'com.google.guava:guava:31.1-android'
}

View File

@ -1,3 +0,0 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true

View File

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

View File

@ -1,7 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.yanshouwang.bluetooth_low_energy">
package="dev.yanshouwang.bluetooth_low_energy">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
</manifest>

View File

@ -0,0 +1,930 @@
// Autogenerated from Pigeon (v4.0.2), do not edit directly.
// See also: https://pub.dev/packages/pigeon
package dev.yanshouwang.bluetooth_low_energy.pigeon;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.plugin.common.BasicMessageChannel;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MessageCodec;
import io.flutter.plugin.common.StandardMessageCodec;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
/** Generated class from Pigeon. */
@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
public class Api {
public interface Result<T> {
void success(T result);
void error(Throwable error);
}
private static class CentralManagerHostApiCodec extends StandardMessageCodec {
public static final CentralManagerHostApiCodec INSTANCE = new CentralManagerHostApiCodec();
private CentralManagerHostApiCodec() {}
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
public interface CentralManagerHostApi {
void authorize(Result<Boolean> result);
@NonNull Long getState();
void addStateObserver();
void removeStateObserver();
void startScan(@Nullable List<byte[]> uuidBuffers, Result<Void> result);
void stopScan();
void connect(@NonNull byte[] uuidBuffer, Result<byte[]> result);
/** The codec used by CentralManagerHostApi. */
static MessageCodec<Object> getCodec() {
return CentralManagerHostApiCodec.INSTANCE;
}
/** Sets up an instance of `CentralManagerHostApi` to handle messages through the `binaryMessenger`. */
static void setup(BinaryMessenger binaryMessenger, CentralManagerHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerHostApi.authorize", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
Result<Boolean> resultCallback = new Result<Boolean>() {
public void success(Boolean result) {
wrapped.put("result", result);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.authorize(resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerHostApi.getState", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
Long output = api.getState();
wrapped.put("result", output);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerHostApi.addStateObserver", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
api.addStateObserver();
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerHostApi.removeStateObserver", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
api.removeStateObserver();
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerHostApi.startScan", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
List<byte[]> uuidBuffersArg = (List<byte[]>)args.get(0);
Result<Void> resultCallback = new Result<Void>() {
public void success(Void result) {
wrapped.put("result", null);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.startScan(uuidBuffersArg, resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerHostApi.stopScan", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
api.stopScan();
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerHostApi.connect", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
byte[] uuidBufferArg = (byte[])args.get(0);
if (uuidBufferArg == null) {
throw new NullPointerException("uuidBufferArg unexpectedly null.");
}
Result<byte[]> resultCallback = new Result<byte[]>() {
public void success(byte[] result) {
wrapped.put("result", result);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.connect(uuidBufferArg, resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
}
}
private static class CentralManagerFlutterApiCodec extends StandardMessageCodec {
public static final CentralManagerFlutterApiCodec INSTANCE = new CentralManagerFlutterApiCodec();
private CentralManagerFlutterApiCodec() {}
}
/** Generated class from Pigeon that represents Flutter messages that can be called from Java.*/
public static class CentralManagerFlutterApi {
private final BinaryMessenger binaryMessenger;
public CentralManagerFlutterApi(BinaryMessenger argBinaryMessenger){
this.binaryMessenger = argBinaryMessenger;
}
public interface Reply<T> {
void reply(T reply);
}
static MessageCodec<Object> getCodec() {
return CentralManagerFlutterApiCodec.INSTANCE;
}
public void notifyState(@NonNull Long stateNumberArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerFlutterApi.notifyState", getCodec());
channel.send(new ArrayList<Object>(Arrays.asList(stateNumberArg)), channelReply -> {
callback.reply(null);
});
}
public void notifyAdvertisement(@NonNull byte[] advertisementBufferArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerFlutterApi.notifyAdvertisement", getCodec());
channel.send(new ArrayList<Object>(Arrays.asList(advertisementBufferArg)), channelReply -> {
callback.reply(null);
});
}
}
private static class PeripheralHostApiCodec extends StandardMessageCodec {
public static final PeripheralHostApiCodec INSTANCE = new PeripheralHostApiCodec();
private PeripheralHostApiCodec() {}
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
public interface PeripheralHostApi {
void allocate(@NonNull Long id, @NonNull Long instanceId);
void free(@NonNull Long id);
void disconnect(@NonNull Long id, Result<Void> result);
void discoverServices(@NonNull Long id, Result<List<byte[]>> result);
/** The codec used by PeripheralHostApi. */
static MessageCodec<Object> getCodec() {
return PeripheralHostApiCodec.INSTANCE;
}
/** Sets up an instance of `PeripheralHostApi` to handle messages through the `binaryMessenger`. */
static void setup(BinaryMessenger binaryMessenger, PeripheralHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.PeripheralHostApi.allocate", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Number instanceIdArg = (Number)args.get(1);
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
api.allocate((idArg == null) ? null : idArg.longValue(), (instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.PeripheralHostApi.free", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
api.free((idArg == null) ? null : idArg.longValue());
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.PeripheralHostApi.disconnect", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Result<Void> resultCallback = new Result<Void>() {
public void success(Void result) {
wrapped.put("result", null);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.disconnect((idArg == null) ? null : idArg.longValue(), resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.PeripheralHostApi.discoverServices", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Result<List<byte[]>> resultCallback = new Result<List<byte[]>>() {
public void success(List<byte[]> result) {
wrapped.put("result", result);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.discoverServices((idArg == null) ? null : idArg.longValue(), resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
}
}
private static class PeripheralFlutterApiCodec extends StandardMessageCodec {
public static final PeripheralFlutterApiCodec INSTANCE = new PeripheralFlutterApiCodec();
private PeripheralFlutterApiCodec() {}
}
/** Generated class from Pigeon that represents Flutter messages that can be called from Java.*/
public static class PeripheralFlutterApi {
private final BinaryMessenger binaryMessenger;
public PeripheralFlutterApi(BinaryMessenger argBinaryMessenger){
this.binaryMessenger = argBinaryMessenger;
}
public interface Reply<T> {
void reply(T reply);
}
static MessageCodec<Object> getCodec() {
return PeripheralFlutterApiCodec.INSTANCE;
}
public void notifyConnectionLost(@NonNull Long idArg, @NonNull byte[] errorBufferArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.PeripheralFlutterApi.notifyConnectionLost", getCodec());
channel.send(new ArrayList<Object>(Arrays.asList(idArg, errorBufferArg)), channelReply -> {
callback.reply(null);
});
}
}
private static class GattServiceHostApiCodec extends StandardMessageCodec {
public static final GattServiceHostApiCodec INSTANCE = new GattServiceHostApiCodec();
private GattServiceHostApiCodec() {}
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
public interface GattServiceHostApi {
void allocate(@NonNull Long id, @NonNull Long instanceId);
void free(@NonNull Long id);
void discoverCharacteristics(@NonNull Long id, Result<List<byte[]>> result);
/** The codec used by GattServiceHostApi. */
static MessageCodec<Object> getCodec() {
return GattServiceHostApiCodec.INSTANCE;
}
/** Sets up an instance of `GattServiceHostApi` to handle messages through the `binaryMessenger`. */
static void setup(BinaryMessenger binaryMessenger, GattServiceHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattServiceHostApi.allocate", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Number instanceIdArg = (Number)args.get(1);
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
api.allocate((idArg == null) ? null : idArg.longValue(), (instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattServiceHostApi.free", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
api.free((idArg == null) ? null : idArg.longValue());
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattServiceHostApi.discoverCharacteristics", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Result<List<byte[]>> resultCallback = new Result<List<byte[]>>() {
public void success(List<byte[]> result) {
wrapped.put("result", result);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.discoverCharacteristics((idArg == null) ? null : idArg.longValue(), resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
}
}
private static class GattCharacteristicHostApiCodec extends StandardMessageCodec {
public static final GattCharacteristicHostApiCodec INSTANCE = new GattCharacteristicHostApiCodec();
private GattCharacteristicHostApiCodec() {}
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
public interface GattCharacteristicHostApi {
void allocate(@NonNull Long id, @NonNull Long instanceId);
void free(@NonNull Long id);
void discoverDescriptors(@NonNull Long id, Result<List<byte[]>> result);
void read(@NonNull Long id, Result<byte[]> result);
void write(@NonNull Long id, @NonNull byte[] value, @NonNull Boolean withoutResponse, Result<Void> result);
void setNotify(@NonNull Long id, @NonNull Boolean value, Result<Void> result);
/** The codec used by GattCharacteristicHostApi. */
static MessageCodec<Object> getCodec() {
return GattCharacteristicHostApiCodec.INSTANCE;
}
/** Sets up an instance of `GattCharacteristicHostApi` to handle messages through the `binaryMessenger`. */
static void setup(BinaryMessenger binaryMessenger, GattCharacteristicHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattCharacteristicHostApi.allocate", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Number instanceIdArg = (Number)args.get(1);
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
api.allocate((idArg == null) ? null : idArg.longValue(), (instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattCharacteristicHostApi.free", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
api.free((idArg == null) ? null : idArg.longValue());
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattCharacteristicHostApi.discoverDescriptors", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Result<List<byte[]>> resultCallback = new Result<List<byte[]>>() {
public void success(List<byte[]> result) {
wrapped.put("result", result);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.discoverDescriptors((idArg == null) ? null : idArg.longValue(), resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattCharacteristicHostApi.read", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Result<byte[]> resultCallback = new Result<byte[]>() {
public void success(byte[] result) {
wrapped.put("result", result);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.read((idArg == null) ? null : idArg.longValue(), resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattCharacteristicHostApi.write", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
byte[] valueArg = (byte[])args.get(1);
if (valueArg == null) {
throw new NullPointerException("valueArg unexpectedly null.");
}
Boolean withoutResponseArg = (Boolean)args.get(2);
if (withoutResponseArg == null) {
throw new NullPointerException("withoutResponseArg unexpectedly null.");
}
Result<Void> resultCallback = new Result<Void>() {
public void success(Void result) {
wrapped.put("result", null);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.write((idArg == null) ? null : idArg.longValue(), valueArg, withoutResponseArg, resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattCharacteristicHostApi.setNotify", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Boolean valueArg = (Boolean)args.get(1);
if (valueArg == null) {
throw new NullPointerException("valueArg unexpectedly null.");
}
Result<Void> resultCallback = new Result<Void>() {
public void success(Void result) {
wrapped.put("result", null);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.setNotify((idArg == null) ? null : idArg.longValue(), valueArg, resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
}
}
private static class GattCharacteristicFlutterApiCodec extends StandardMessageCodec {
public static final GattCharacteristicFlutterApiCodec INSTANCE = new GattCharacteristicFlutterApiCodec();
private GattCharacteristicFlutterApiCodec() {}
}
/** Generated class from Pigeon that represents Flutter messages that can be called from Java.*/
public static class GattCharacteristicFlutterApi {
private final BinaryMessenger binaryMessenger;
public GattCharacteristicFlutterApi(BinaryMessenger argBinaryMessenger){
this.binaryMessenger = argBinaryMessenger;
}
public interface Reply<T> {
void reply(T reply);
}
static MessageCodec<Object> getCodec() {
return GattCharacteristicFlutterApiCodec.INSTANCE;
}
public void notifyValue(@NonNull Long idArg, @NonNull byte[] valueArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattCharacteristicFlutterApi.notifyValue", getCodec());
channel.send(new ArrayList<Object>(Arrays.asList(idArg, valueArg)), channelReply -> {
callback.reply(null);
});
}
}
private static class GattDescriptorHostApiCodec extends StandardMessageCodec {
public static final GattDescriptorHostApiCodec INSTANCE = new GattDescriptorHostApiCodec();
private GattDescriptorHostApiCodec() {}
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
public interface GattDescriptorHostApi {
void allocate(@NonNull Long id, @NonNull Long instanceId);
void free(@NonNull Long id);
void read(@NonNull Long id, Result<byte[]> result);
void write(@NonNull Long id, @NonNull byte[] value, Result<Void> result);
/** The codec used by GattDescriptorHostApi. */
static MessageCodec<Object> getCodec() {
return GattDescriptorHostApiCodec.INSTANCE;
}
/** Sets up an instance of `GattDescriptorHostApi` to handle messages through the `binaryMessenger`. */
static void setup(BinaryMessenger binaryMessenger, GattDescriptorHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattDescriptorHostApi.allocate", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Number instanceIdArg = (Number)args.get(1);
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
api.allocate((idArg == null) ? null : idArg.longValue(), (instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattDescriptorHostApi.free", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
api.free((idArg == null) ? null : idArg.longValue());
wrapped.put("result", null);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
}
reply.reply(wrapped);
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattDescriptorHostApi.read", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Result<byte[]> resultCallback = new Result<byte[]>() {
public void success(byte[] result) {
wrapped.put("result", result);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.read((idArg == null) ? null : idArg.longValue(), resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattDescriptorHostApi.write", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
Number idArg = (Number)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
byte[] valueArg = (byte[])args.get(1);
if (valueArg == null) {
throw new NullPointerException("valueArg unexpectedly null.");
}
Result<Void> resultCallback = new Result<Void>() {
public void success(Void result) {
wrapped.put("result", null);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.write((idArg == null) ? null : idArg.longValue(), valueArg, resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
}
}
private static Map<String, Object> wrapError(Throwable exception) {
Map<String, Object> errorMap = new HashMap<>();
errorMap.put("message", exception.toString());
errorMap.put("code", exception.getClass().getSimpleName());
errorMap.put("details", "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
return errorMap;
}
}

View File

@ -0,0 +1,153 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public interface AdvertisementOrBuilder extends
// @@protoc_insertion_point(interface_extends:proto.Advertisement)
com.google.protobuf.MessageOrBuilder {
/**
* <code>.proto.UUID uuid = 1;</code>
* @return Whether the uuid field is set.
*/
boolean hasUuid();
/**
* <code>.proto.UUID uuid = 1;</code>
* @return The uuid.
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid();
/**
* <code>.proto.UUID uuid = 1;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder();
/**
* <code>int32 rssi = 2;</code>
* @return The rssi.
*/
int getRssi();
/**
* <code>optional bool connectable = 3;</code>
* @return Whether the connectable field is set.
*/
boolean hasConnectable();
/**
* <code>optional bool connectable = 3;</code>
* @return The connectable.
*/
boolean getConnectable();
/**
* <code>bytes data = 4;</code>
* @return The data.
*/
com.google.protobuf.ByteString getData();
/**
* <code>optional string local_name = 5;</code>
* @return Whether the localName field is set.
*/
boolean hasLocalName();
/**
* <code>optional string local_name = 5;</code>
* @return The localName.
*/
java.lang.String getLocalName();
/**
* <code>optional string local_name = 5;</code>
* @return The bytes for localName.
*/
com.google.protobuf.ByteString
getLocalNameBytes();
/**
* <code>bytes manufacturer_specific_data = 6;</code>
* @return The manufacturerSpecificData.
*/
com.google.protobuf.ByteString getManufacturerSpecificData();
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
*/
java.util.List<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData>
getServiceDatasList();
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.ServiceData getServiceDatas(int index);
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
*/
int getServiceDatasCount();
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
*/
java.util.List<? extends dev.yanshouwang.bluetooth_low_energy.proto.ServiceDataOrBuilder>
getServiceDatasOrBuilderList();
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.ServiceDataOrBuilder getServiceDatasOrBuilder(
int index);
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
*/
java.util.List<dev.yanshouwang.bluetooth_low_energy.proto.UUID>
getServiceUuidsList();
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUID getServiceUuids(int index);
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
*/
int getServiceUuidsCount();
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
*/
java.util.List<? extends dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>
getServiceUuidsOrBuilderList();
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getServiceUuidsOrBuilder(
int index);
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
*/
java.util.List<dev.yanshouwang.bluetooth_low_energy.proto.UUID>
getSolicitedServiceUuidsList();
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUID getSolicitedServiceUuids(int index);
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
*/
int getSolicitedServiceUuidsCount();
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
*/
java.util.List<? extends dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>
getSolicitedServiceUuidsOrBuilderList();
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getSolicitedServiceUuidsOrBuilder(
int index);
/**
* <code>optional int32 tx_power_level = 10;</code>
* @return Whether the txPowerLevel field is set.
*/
boolean hasTxPowerLevel();
/**
* <code>optional int32 tx_power_level = 10;</code>
* @return The txPowerLevel.
*/
int getTxPowerLevel();
}

View File

@ -0,0 +1,559 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
/**
* Protobuf type {@code proto.BluetoothLowEnergyException}
*/
public final class BluetoothLowEnergyException extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:proto.BluetoothLowEnergyException)
BluetoothLowEnergyExceptionOrBuilder {
private static final long serialVersionUID = 0L;
// Use BluetoothLowEnergyException.newBuilder() to construct.
private BluetoothLowEnergyException(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private BluetoothLowEnergyException() {
message_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new BluetoothLowEnergyException();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private BluetoothLowEnergyException(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
java.lang.String s = input.readStringRequireUtf8();
message_ = s;
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_BluetoothLowEnergyException_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_BluetoothLowEnergyException_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.class, dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.Builder.class);
}
public static final int MESSAGE_FIELD_NUMBER = 1;
private volatile java.lang.Object message_;
/**
* <code>string message = 1;</code>
* @return The message.
*/
@java.lang.Override
public java.lang.String getMessage() {
java.lang.Object ref = message_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
message_ = s;
return s;
}
}
/**
* <code>string message = 1;</code>
* @return The bytes for message.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getMessageBytes() {
java.lang.Object ref = message_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
message_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, message_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, message_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException)) {
return super.equals(obj);
}
dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException other = (dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException) obj;
if (!getMessage()
.equals(other.getMessage())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
hash = (53 * hash) + getMessage().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code proto.BluetoothLowEnergyException}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:proto.BluetoothLowEnergyException)
dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyExceptionOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_BluetoothLowEnergyException_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_BluetoothLowEnergyException_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.class, dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.Builder.class);
}
// Construct using dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
message_ = "";
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_BluetoothLowEnergyException_descriptor;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException getDefaultInstanceForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.getDefaultInstance();
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException build() {
dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException buildPartial() {
dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException result = new dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException(this);
result.message_ = message_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException) {
return mergeFrom((dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException other) {
if (other == dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.getDefaultInstance()) return this;
if (!other.getMessage().isEmpty()) {
message_ = other.message_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object message_ = "";
/**
* <code>string message = 1;</code>
* @return The message.
*/
public java.lang.String getMessage() {
java.lang.Object ref = message_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
message_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string message = 1;</code>
* @return The bytes for message.
*/
public com.google.protobuf.ByteString
getMessageBytes() {
java.lang.Object ref = message_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
message_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string message = 1;</code>
* @param value The message to set.
* @return This builder for chaining.
*/
public Builder setMessage(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
message_ = value;
onChanged();
return this;
}
/**
* <code>string message = 1;</code>
* @return This builder for chaining.
*/
public Builder clearMessage() {
message_ = getDefaultInstance().getMessage();
onChanged();
return this;
}
/**
* <code>string message = 1;</code>
* @param value The bytes for message to set.
* @return This builder for chaining.
*/
public Builder setMessageBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
message_ = value;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:proto.BluetoothLowEnergyException)
}
// @@protoc_insertion_point(class_scope:proto.BluetoothLowEnergyException)
private static final dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException();
}
public static dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<BluetoothLowEnergyException>
PARSER = new com.google.protobuf.AbstractParser<BluetoothLowEnergyException>() {
@java.lang.Override
public BluetoothLowEnergyException parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new BluetoothLowEnergyException(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<BluetoothLowEnergyException> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<BluetoothLowEnergyException> getParserForType() {
return PARSER;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,21 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public interface BluetoothLowEnergyExceptionOrBuilder extends
// @@protoc_insertion_point(interface_extends:proto.BluetoothLowEnergyException)
com.google.protobuf.MessageOrBuilder {
/**
* <code>string message = 1;</code>
* @return The message.
*/
java.lang.String getMessage();
/**
* <code>string message = 1;</code>
* @return The bytes for message.
*/
com.google.protobuf.ByteString
getMessageBytes();
}

View File

@ -0,0 +1,122 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
/**
* Protobuf enum {@code proto.BluetoothState}
*/
public enum BluetoothState
implements com.google.protobuf.ProtocolMessageEnum {
/**
* <code>BLUETOOTH_STATE_UNSUPPORTED = 0;</code>
*/
BLUETOOTH_STATE_UNSUPPORTED(0),
/**
* <code>BLUETOOTH_STATE_POWERED_OFF = 1;</code>
*/
BLUETOOTH_STATE_POWERED_OFF(1),
/**
* <code>BLUETOOTH_STATE_POWERED_ON = 2;</code>
*/
BLUETOOTH_STATE_POWERED_ON(2),
UNRECOGNIZED(-1),
;
/**
* <code>BLUETOOTH_STATE_UNSUPPORTED = 0;</code>
*/
public static final int BLUETOOTH_STATE_UNSUPPORTED_VALUE = 0;
/**
* <code>BLUETOOTH_STATE_POWERED_OFF = 1;</code>
*/
public static final int BLUETOOTH_STATE_POWERED_OFF_VALUE = 1;
/**
* <code>BLUETOOTH_STATE_POWERED_ON = 2;</code>
*/
public static final int BLUETOOTH_STATE_POWERED_ON_VALUE = 2;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static BluetoothState valueOf(int value) {
return forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
*/
public static BluetoothState forNumber(int value) {
switch (value) {
case 0: return BLUETOOTH_STATE_UNSUPPORTED;
case 1: return BLUETOOTH_STATE_POWERED_OFF;
case 2: return BLUETOOTH_STATE_POWERED_ON;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<BluetoothState>
internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<
BluetoothState> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<BluetoothState>() {
public BluetoothState findValueByNumber(int number) {
return BluetoothState.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalStateException(
"Can't get the descriptor of an unrecognized enum value.");
}
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.getDescriptor().getEnumTypes().get(0);
}
private static final BluetoothState[] VALUES = values();
public static BluetoothState valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int value;
private BluetoothState(int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:proto.BluetoothState)
}

View File

@ -0,0 +1,934 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
/**
* Protobuf type {@code proto.GattCharacteristic}
*/
public final class GattCharacteristic extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:proto.GattCharacteristic)
GattCharacteristicOrBuilder {
private static final long serialVersionUID = 0L;
// Use GattCharacteristic.newBuilder() to construct.
private GattCharacteristic(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private GattCharacteristic() {
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new GattCharacteristic();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private GattCharacteristic(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
id_ = input.readInt64();
break;
}
case 18: {
dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder subBuilder = null;
if (uuid_ != null) {
subBuilder = uuid_.toBuilder();
}
uuid_ = input.readMessage(dev.yanshouwang.bluetooth_low_energy.proto.UUID.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(uuid_);
uuid_ = subBuilder.buildPartial();
}
break;
}
case 24: {
canRead_ = input.readBool();
break;
}
case 32: {
canWrite_ = input.readBool();
break;
}
case 40: {
canWriteWithoutResponse_ = input.readBool();
break;
}
case 48: {
canNotify_ = input.readBool();
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattCharacteristic_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattCharacteristic_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.class, dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.Builder.class);
}
public static final int ID_FIELD_NUMBER = 1;
private long id_;
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
@java.lang.Override
public long getId() {
return id_;
}
public static final int UUID_FIELD_NUMBER = 2;
private dev.yanshouwang.bluetooth_low_energy.proto.UUID uuid_;
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
@java.lang.Override
public boolean hasUuid() {
return uuid_ != null;
}
/**
* <code>.proto.UUID uuid = 2;</code>
* @return The uuid.
*/
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid() {
return uuid_ == null ? dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder() {
return getUuid();
}
public static final int CAN_READ_FIELD_NUMBER = 3;
private boolean canRead_;
/**
* <code>bool can_read = 3;</code>
* @return The canRead.
*/
@java.lang.Override
public boolean getCanRead() {
return canRead_;
}
public static final int CAN_WRITE_FIELD_NUMBER = 4;
private boolean canWrite_;
/**
* <code>bool can_write = 4;</code>
* @return The canWrite.
*/
@java.lang.Override
public boolean getCanWrite() {
return canWrite_;
}
public static final int CAN_WRITE_WITHOUT_RESPONSE_FIELD_NUMBER = 5;
private boolean canWriteWithoutResponse_;
/**
* <code>bool can_write_without_response = 5;</code>
* @return The canWriteWithoutResponse.
*/
@java.lang.Override
public boolean getCanWriteWithoutResponse() {
return canWriteWithoutResponse_;
}
public static final int CAN_NOTIFY_FIELD_NUMBER = 6;
private boolean canNotify_;
/**
* <code>bool can_notify = 6;</code>
* @return The canNotify.
*/
@java.lang.Override
public boolean getCanNotify() {
return canNotify_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (id_ != 0L) {
output.writeInt64(1, id_);
}
if (uuid_ != null) {
output.writeMessage(2, getUuid());
}
if (canRead_ != false) {
output.writeBool(3, canRead_);
}
if (canWrite_ != false) {
output.writeBool(4, canWrite_);
}
if (canWriteWithoutResponse_ != false) {
output.writeBool(5, canWriteWithoutResponse_);
}
if (canNotify_ != false) {
output.writeBool(6, canNotify_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (id_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(1, id_);
}
if (uuid_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, getUuid());
}
if (canRead_ != false) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(3, canRead_);
}
if (canWrite_ != false) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(4, canWrite_);
}
if (canWriteWithoutResponse_ != false) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(5, canWriteWithoutResponse_);
}
if (canNotify_ != false) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(6, canNotify_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic)) {
return super.equals(obj);
}
dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic other = (dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic) obj;
if (getId()
!= other.getId()) return false;
if (hasUuid() != other.hasUuid()) return false;
if (hasUuid()) {
if (!getUuid()
.equals(other.getUuid())) return false;
}
if (getCanRead()
!= other.getCanRead()) return false;
if (getCanWrite()
!= other.getCanWrite()) return false;
if (getCanWriteWithoutResponse()
!= other.getCanWriteWithoutResponse()) return false;
if (getCanNotify()
!= other.getCanNotify()) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + ID_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getId());
if (hasUuid()) {
hash = (37 * hash) + UUID_FIELD_NUMBER;
hash = (53 * hash) + getUuid().hashCode();
}
hash = (37 * hash) + CAN_READ_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getCanRead());
hash = (37 * hash) + CAN_WRITE_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getCanWrite());
hash = (37 * hash) + CAN_WRITE_WITHOUT_RESPONSE_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getCanWriteWithoutResponse());
hash = (37 * hash) + CAN_NOTIFY_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getCanNotify());
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code proto.GattCharacteristic}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:proto.GattCharacteristic)
dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristicOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattCharacteristic_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattCharacteristic_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.class, dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.Builder.class);
}
// Construct using dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
id_ = 0L;
if (uuidBuilder_ == null) {
uuid_ = null;
} else {
uuid_ = null;
uuidBuilder_ = null;
}
canRead_ = false;
canWrite_ = false;
canWriteWithoutResponse_ = false;
canNotify_ = false;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattCharacteristic_descriptor;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic getDefaultInstanceForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.getDefaultInstance();
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic build() {
dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic buildPartial() {
dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic result = new dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic(this);
result.id_ = id_;
if (uuidBuilder_ == null) {
result.uuid_ = uuid_;
} else {
result.uuid_ = uuidBuilder_.build();
}
result.canRead_ = canRead_;
result.canWrite_ = canWrite_;
result.canWriteWithoutResponse_ = canWriteWithoutResponse_;
result.canNotify_ = canNotify_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic) {
return mergeFrom((dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic other) {
if (other == dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.getDefaultInstance()) return this;
if (other.getId() != 0L) {
setId(other.getId());
}
if (other.hasUuid()) {
mergeUuid(other.getUuid());
}
if (other.getCanRead() != false) {
setCanRead(other.getCanRead());
}
if (other.getCanWrite() != false) {
setCanWrite(other.getCanWrite());
}
if (other.getCanWriteWithoutResponse() != false) {
setCanWriteWithoutResponse(other.getCanWriteWithoutResponse());
}
if (other.getCanNotify() != false) {
setCanNotify(other.getCanNotify());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private long id_ ;
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
@java.lang.Override
public long getId() {
return id_;
}
/**
* <code>int64 id = 1;</code>
* @param value The id to set.
* @return This builder for chaining.
*/
public Builder setId(long value) {
id_ = value;
onChanged();
return this;
}
/**
* <code>int64 id = 1;</code>
* @return This builder for chaining.
*/
public Builder clearId() {
id_ = 0L;
onChanged();
return this;
}
private dev.yanshouwang.bluetooth_low_energy.proto.UUID uuid_;
private com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder> uuidBuilder_;
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
public boolean hasUuid() {
return uuidBuilder_ != null || uuid_ != null;
}
/**
* <code>.proto.UUID uuid = 2;</code>
* @return The uuid.
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid() {
if (uuidBuilder_ == null) {
return uuid_ == null ? dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
} else {
return uuidBuilder_.getMessage();
}
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder setUuid(dev.yanshouwang.bluetooth_low_energy.proto.UUID value) {
if (uuidBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
uuid_ = value;
onChanged();
} else {
uuidBuilder_.setMessage(value);
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder setUuid(
dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder builderForValue) {
if (uuidBuilder_ == null) {
uuid_ = builderForValue.build();
onChanged();
} else {
uuidBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder mergeUuid(dev.yanshouwang.bluetooth_low_energy.proto.UUID value) {
if (uuidBuilder_ == null) {
if (uuid_ != null) {
uuid_ =
dev.yanshouwang.bluetooth_low_energy.proto.UUID.newBuilder(uuid_).mergeFrom(value).buildPartial();
} else {
uuid_ = value;
}
onChanged();
} else {
uuidBuilder_.mergeFrom(value);
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder clearUuid() {
if (uuidBuilder_ == null) {
uuid_ = null;
onChanged();
} else {
uuid_ = null;
uuidBuilder_ = null;
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder getUuidBuilder() {
onChanged();
return getUuidFieldBuilder().getBuilder();
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder() {
if (uuidBuilder_ != null) {
return uuidBuilder_.getMessageOrBuilder();
} else {
return uuid_ == null ?
dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
}
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>
getUuidFieldBuilder() {
if (uuidBuilder_ == null) {
uuidBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>(
getUuid(),
getParentForChildren(),
isClean());
uuid_ = null;
}
return uuidBuilder_;
}
private boolean canRead_ ;
/**
* <code>bool can_read = 3;</code>
* @return The canRead.
*/
@java.lang.Override
public boolean getCanRead() {
return canRead_;
}
/**
* <code>bool can_read = 3;</code>
* @param value The canRead to set.
* @return This builder for chaining.
*/
public Builder setCanRead(boolean value) {
canRead_ = value;
onChanged();
return this;
}
/**
* <code>bool can_read = 3;</code>
* @return This builder for chaining.
*/
public Builder clearCanRead() {
canRead_ = false;
onChanged();
return this;
}
private boolean canWrite_ ;
/**
* <code>bool can_write = 4;</code>
* @return The canWrite.
*/
@java.lang.Override
public boolean getCanWrite() {
return canWrite_;
}
/**
* <code>bool can_write = 4;</code>
* @param value The canWrite to set.
* @return This builder for chaining.
*/
public Builder setCanWrite(boolean value) {
canWrite_ = value;
onChanged();
return this;
}
/**
* <code>bool can_write = 4;</code>
* @return This builder for chaining.
*/
public Builder clearCanWrite() {
canWrite_ = false;
onChanged();
return this;
}
private boolean canWriteWithoutResponse_ ;
/**
* <code>bool can_write_without_response = 5;</code>
* @return The canWriteWithoutResponse.
*/
@java.lang.Override
public boolean getCanWriteWithoutResponse() {
return canWriteWithoutResponse_;
}
/**
* <code>bool can_write_without_response = 5;</code>
* @param value The canWriteWithoutResponse to set.
* @return This builder for chaining.
*/
public Builder setCanWriteWithoutResponse(boolean value) {
canWriteWithoutResponse_ = value;
onChanged();
return this;
}
/**
* <code>bool can_write_without_response = 5;</code>
* @return This builder for chaining.
*/
public Builder clearCanWriteWithoutResponse() {
canWriteWithoutResponse_ = false;
onChanged();
return this;
}
private boolean canNotify_ ;
/**
* <code>bool can_notify = 6;</code>
* @return The canNotify.
*/
@java.lang.Override
public boolean getCanNotify() {
return canNotify_;
}
/**
* <code>bool can_notify = 6;</code>
* @param value The canNotify to set.
* @return This builder for chaining.
*/
public Builder setCanNotify(boolean value) {
canNotify_ = value;
onChanged();
return this;
}
/**
* <code>bool can_notify = 6;</code>
* @return This builder for chaining.
*/
public Builder clearCanNotify() {
canNotify_ = false;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:proto.GattCharacteristic)
}
// @@protoc_insertion_point(class_scope:proto.GattCharacteristic)
private static final dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic();
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<GattCharacteristic>
PARSER = new com.google.protobuf.AbstractParser<GattCharacteristic>() {
@java.lang.Override
public GattCharacteristic parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new GattCharacteristic(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<GattCharacteristic> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<GattCharacteristic> getParserForType() {
return PARSER;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,54 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public interface GattCharacteristicOrBuilder extends
// @@protoc_insertion_point(interface_extends:proto.GattCharacteristic)
com.google.protobuf.MessageOrBuilder {
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
long getId();
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
boolean hasUuid();
/**
* <code>.proto.UUID uuid = 2;</code>
* @return The uuid.
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid();
/**
* <code>.proto.UUID uuid = 2;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder();
/**
* <code>bool can_read = 3;</code>
* @return The canRead.
*/
boolean getCanRead();
/**
* <code>bool can_write = 4;</code>
* @return The canWrite.
*/
boolean getCanWrite();
/**
* <code>bool can_write_without_response = 5;</code>
* @return The canWriteWithoutResponse.
*/
boolean getCanWriteWithoutResponse();
/**
* <code>bool can_notify = 6;</code>
* @return The canNotify.
*/
boolean getCanNotify();
}

View File

@ -0,0 +1,674 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
/**
* Protobuf type {@code proto.GattDescriptor}
*/
public final class GattDescriptor extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:proto.GattDescriptor)
GattDescriptorOrBuilder {
private static final long serialVersionUID = 0L;
// Use GattDescriptor.newBuilder() to construct.
private GattDescriptor(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private GattDescriptor() {
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new GattDescriptor();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private GattDescriptor(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
id_ = input.readInt64();
break;
}
case 18: {
dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder subBuilder = null;
if (uuid_ != null) {
subBuilder = uuid_.toBuilder();
}
uuid_ = input.readMessage(dev.yanshouwang.bluetooth_low_energy.proto.UUID.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(uuid_);
uuid_ = subBuilder.buildPartial();
}
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattDescriptor_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattDescriptor_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.class, dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.Builder.class);
}
public static final int ID_FIELD_NUMBER = 1;
private long id_;
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
@java.lang.Override
public long getId() {
return id_;
}
public static final int UUID_FIELD_NUMBER = 2;
private dev.yanshouwang.bluetooth_low_energy.proto.UUID uuid_;
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
@java.lang.Override
public boolean hasUuid() {
return uuid_ != null;
}
/**
* <code>.proto.UUID uuid = 2;</code>
* @return The uuid.
*/
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid() {
return uuid_ == null ? dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder() {
return getUuid();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (id_ != 0L) {
output.writeInt64(1, id_);
}
if (uuid_ != null) {
output.writeMessage(2, getUuid());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (id_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(1, id_);
}
if (uuid_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, getUuid());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor)) {
return super.equals(obj);
}
dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor other = (dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor) obj;
if (getId()
!= other.getId()) return false;
if (hasUuid() != other.hasUuid()) return false;
if (hasUuid()) {
if (!getUuid()
.equals(other.getUuid())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + ID_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getId());
if (hasUuid()) {
hash = (37 * hash) + UUID_FIELD_NUMBER;
hash = (53 * hash) + getUuid().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code proto.GattDescriptor}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:proto.GattDescriptor)
dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptorOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattDescriptor_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattDescriptor_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.class, dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.Builder.class);
}
// Construct using dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
id_ = 0L;
if (uuidBuilder_ == null) {
uuid_ = null;
} else {
uuid_ = null;
uuidBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattDescriptor_descriptor;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor getDefaultInstanceForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.getDefaultInstance();
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor build() {
dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor buildPartial() {
dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor result = new dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor(this);
result.id_ = id_;
if (uuidBuilder_ == null) {
result.uuid_ = uuid_;
} else {
result.uuid_ = uuidBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor) {
return mergeFrom((dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor other) {
if (other == dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.getDefaultInstance()) return this;
if (other.getId() != 0L) {
setId(other.getId());
}
if (other.hasUuid()) {
mergeUuid(other.getUuid());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private long id_ ;
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
@java.lang.Override
public long getId() {
return id_;
}
/**
* <code>int64 id = 1;</code>
* @param value The id to set.
* @return This builder for chaining.
*/
public Builder setId(long value) {
id_ = value;
onChanged();
return this;
}
/**
* <code>int64 id = 1;</code>
* @return This builder for chaining.
*/
public Builder clearId() {
id_ = 0L;
onChanged();
return this;
}
private dev.yanshouwang.bluetooth_low_energy.proto.UUID uuid_;
private com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder> uuidBuilder_;
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
public boolean hasUuid() {
return uuidBuilder_ != null || uuid_ != null;
}
/**
* <code>.proto.UUID uuid = 2;</code>
* @return The uuid.
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid() {
if (uuidBuilder_ == null) {
return uuid_ == null ? dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
} else {
return uuidBuilder_.getMessage();
}
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder setUuid(dev.yanshouwang.bluetooth_low_energy.proto.UUID value) {
if (uuidBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
uuid_ = value;
onChanged();
} else {
uuidBuilder_.setMessage(value);
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder setUuid(
dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder builderForValue) {
if (uuidBuilder_ == null) {
uuid_ = builderForValue.build();
onChanged();
} else {
uuidBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder mergeUuid(dev.yanshouwang.bluetooth_low_energy.proto.UUID value) {
if (uuidBuilder_ == null) {
if (uuid_ != null) {
uuid_ =
dev.yanshouwang.bluetooth_low_energy.proto.UUID.newBuilder(uuid_).mergeFrom(value).buildPartial();
} else {
uuid_ = value;
}
onChanged();
} else {
uuidBuilder_.mergeFrom(value);
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder clearUuid() {
if (uuidBuilder_ == null) {
uuid_ = null;
onChanged();
} else {
uuid_ = null;
uuidBuilder_ = null;
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder getUuidBuilder() {
onChanged();
return getUuidFieldBuilder().getBuilder();
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder() {
if (uuidBuilder_ != null) {
return uuidBuilder_.getMessageOrBuilder();
} else {
return uuid_ == null ?
dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
}
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>
getUuidFieldBuilder() {
if (uuidBuilder_ == null) {
uuidBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>(
getUuid(),
getParentForChildren(),
isClean());
uuid_ = null;
}
return uuidBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:proto.GattDescriptor)
}
// @@protoc_insertion_point(class_scope:proto.GattDescriptor)
private static final dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor();
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<GattDescriptor>
PARSER = new com.google.protobuf.AbstractParser<GattDescriptor>() {
@java.lang.Override
public GattDescriptor parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new GattDescriptor(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<GattDescriptor> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<GattDescriptor> getParserForType() {
return PARSER;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,30 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public interface GattDescriptorOrBuilder extends
// @@protoc_insertion_point(interface_extends:proto.GattDescriptor)
com.google.protobuf.MessageOrBuilder {
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
long getId();
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
boolean hasUuid();
/**
* <code>.proto.UUID uuid = 2;</code>
* @return The uuid.
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid();
/**
* <code>.proto.UUID uuid = 2;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder();
}

View File

@ -0,0 +1,674 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
/**
* Protobuf type {@code proto.GattService}
*/
public final class GattService extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:proto.GattService)
GattServiceOrBuilder {
private static final long serialVersionUID = 0L;
// Use GattService.newBuilder() to construct.
private GattService(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private GattService() {
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new GattService();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private GattService(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
id_ = input.readInt64();
break;
}
case 18: {
dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder subBuilder = null;
if (uuid_ != null) {
subBuilder = uuid_.toBuilder();
}
uuid_ = input.readMessage(dev.yanshouwang.bluetooth_low_energy.proto.UUID.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(uuid_);
uuid_ = subBuilder.buildPartial();
}
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattService_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattService_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.GattService.class, dev.yanshouwang.bluetooth_low_energy.proto.GattService.Builder.class);
}
public static final int ID_FIELD_NUMBER = 1;
private long id_;
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
@java.lang.Override
public long getId() {
return id_;
}
public static final int UUID_FIELD_NUMBER = 2;
private dev.yanshouwang.bluetooth_low_energy.proto.UUID uuid_;
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
@java.lang.Override
public boolean hasUuid() {
return uuid_ != null;
}
/**
* <code>.proto.UUID uuid = 2;</code>
* @return The uuid.
*/
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid() {
return uuid_ == null ? dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder() {
return getUuid();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (id_ != 0L) {
output.writeInt64(1, id_);
}
if (uuid_ != null) {
output.writeMessage(2, getUuid());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (id_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(1, id_);
}
if (uuid_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, getUuid());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof dev.yanshouwang.bluetooth_low_energy.proto.GattService)) {
return super.equals(obj);
}
dev.yanshouwang.bluetooth_low_energy.proto.GattService other = (dev.yanshouwang.bluetooth_low_energy.proto.GattService) obj;
if (getId()
!= other.getId()) return false;
if (hasUuid() != other.hasUuid()) return false;
if (hasUuid()) {
if (!getUuid()
.equals(other.getUuid())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + ID_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getId());
if (hasUuid()) {
hash = (37 * hash) + UUID_FIELD_NUMBER;
hash = (53 * hash) + getUuid().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(dev.yanshouwang.bluetooth_low_energy.proto.GattService prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code proto.GattService}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:proto.GattService)
dev.yanshouwang.bluetooth_low_energy.proto.GattServiceOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattService_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattService_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.GattService.class, dev.yanshouwang.bluetooth_low_energy.proto.GattService.Builder.class);
}
// Construct using dev.yanshouwang.bluetooth_low_energy.proto.GattService.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
id_ = 0L;
if (uuidBuilder_ == null) {
uuid_ = null;
} else {
uuid_ = null;
uuidBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_GattService_descriptor;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattService getDefaultInstanceForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.GattService.getDefaultInstance();
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattService build() {
dev.yanshouwang.bluetooth_low_energy.proto.GattService result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattService buildPartial() {
dev.yanshouwang.bluetooth_low_energy.proto.GattService result = new dev.yanshouwang.bluetooth_low_energy.proto.GattService(this);
result.id_ = id_;
if (uuidBuilder_ == null) {
result.uuid_ = uuid_;
} else {
result.uuid_ = uuidBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof dev.yanshouwang.bluetooth_low_energy.proto.GattService) {
return mergeFrom((dev.yanshouwang.bluetooth_low_energy.proto.GattService)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(dev.yanshouwang.bluetooth_low_energy.proto.GattService other) {
if (other == dev.yanshouwang.bluetooth_low_energy.proto.GattService.getDefaultInstance()) return this;
if (other.getId() != 0L) {
setId(other.getId());
}
if (other.hasUuid()) {
mergeUuid(other.getUuid());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
dev.yanshouwang.bluetooth_low_energy.proto.GattService parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (dev.yanshouwang.bluetooth_low_energy.proto.GattService) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private long id_ ;
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
@java.lang.Override
public long getId() {
return id_;
}
/**
* <code>int64 id = 1;</code>
* @param value The id to set.
* @return This builder for chaining.
*/
public Builder setId(long value) {
id_ = value;
onChanged();
return this;
}
/**
* <code>int64 id = 1;</code>
* @return This builder for chaining.
*/
public Builder clearId() {
id_ = 0L;
onChanged();
return this;
}
private dev.yanshouwang.bluetooth_low_energy.proto.UUID uuid_;
private com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder> uuidBuilder_;
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
public boolean hasUuid() {
return uuidBuilder_ != null || uuid_ != null;
}
/**
* <code>.proto.UUID uuid = 2;</code>
* @return The uuid.
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid() {
if (uuidBuilder_ == null) {
return uuid_ == null ? dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
} else {
return uuidBuilder_.getMessage();
}
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder setUuid(dev.yanshouwang.bluetooth_low_energy.proto.UUID value) {
if (uuidBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
uuid_ = value;
onChanged();
} else {
uuidBuilder_.setMessage(value);
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder setUuid(
dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder builderForValue) {
if (uuidBuilder_ == null) {
uuid_ = builderForValue.build();
onChanged();
} else {
uuidBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder mergeUuid(dev.yanshouwang.bluetooth_low_energy.proto.UUID value) {
if (uuidBuilder_ == null) {
if (uuid_ != null) {
uuid_ =
dev.yanshouwang.bluetooth_low_energy.proto.UUID.newBuilder(uuid_).mergeFrom(value).buildPartial();
} else {
uuid_ = value;
}
onChanged();
} else {
uuidBuilder_.mergeFrom(value);
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public Builder clearUuid() {
if (uuidBuilder_ == null) {
uuid_ = null;
onChanged();
} else {
uuid_ = null;
uuidBuilder_ = null;
}
return this;
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder getUuidBuilder() {
onChanged();
return getUuidFieldBuilder().getBuilder();
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder() {
if (uuidBuilder_ != null) {
return uuidBuilder_.getMessageOrBuilder();
} else {
return uuid_ == null ?
dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
}
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>
getUuidFieldBuilder() {
if (uuidBuilder_ == null) {
uuidBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>(
getUuid(),
getParentForChildren(),
isClean());
uuid_ = null;
}
return uuidBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:proto.GattService)
}
// @@protoc_insertion_point(class_scope:proto.GattService)
private static final dev.yanshouwang.bluetooth_low_energy.proto.GattService DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new dev.yanshouwang.bluetooth_low_energy.proto.GattService();
}
public static dev.yanshouwang.bluetooth_low_energy.proto.GattService getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<GattService>
PARSER = new com.google.protobuf.AbstractParser<GattService>() {
@java.lang.Override
public GattService parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new GattService(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<GattService> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<GattService> getParserForType() {
return PARSER;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.GattService getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,30 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public interface GattServiceOrBuilder extends
// @@protoc_insertion_point(interface_extends:proto.GattService)
com.google.protobuf.MessageOrBuilder {
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
long getId();
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
boolean hasUuid();
/**
* <code>.proto.UUID uuid = 2;</code>
* @return The uuid.
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid();
/**
* <code>.proto.UUID uuid = 2;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder();
}

View File

@ -0,0 +1,148 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public final class Messages {
private Messages() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
static final com.google.protobuf.Descriptors.Descriptor
internal_static_proto_Advertisement_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_proto_Advertisement_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_proto_Peripheral_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_proto_Peripheral_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_proto_GattService_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_proto_GattService_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_proto_GattCharacteristic_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_proto_GattCharacteristic_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_proto_GattDescriptor_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_proto_GattDescriptor_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_proto_UUID_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_proto_UUID_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_proto_ServiceData_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_proto_ServiceData_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_proto_BluetoothLowEnergyException_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_proto_BluetoothLowEnergyException_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\024proto/messages.proto\022\005proto\"\351\002\n\rAdvert" +
"isement\022\031\n\004uuid\030\001 \001(\0132\013.proto.UUID\022\014\n\004rs" +
"si\030\002 \001(\005\022\030\n\013connectable\030\003 \001(\010H\000\210\001\001\022\014\n\004da" +
"ta\030\004 \001(\014\022\027\n\nlocal_name\030\005 \001(\tH\001\210\001\001\022\"\n\032man" +
"ufacturer_specific_data\030\006 \001(\014\022)\n\rservice" +
"_datas\030\007 \003(\0132\022.proto.ServiceData\022\"\n\rserv" +
"ice_uuids\030\010 \003(\0132\013.proto.UUID\022,\n\027solicite" +
"d_service_uuids\030\t \003(\0132\013.proto.UUID\022\033\n\016tx" +
"_power_level\030\n \001(\005H\002\210\001\001B\016\n\014_connectableB" +
"\r\n\013_local_nameB\021\n\017_tx_power_level\"6\n\nPer" +
"ipheral\022\n\n\002id\030\001 \001(\003\022\034\n\024maximum_write_len" +
"gth\030\002 \001(\005\"4\n\013GattService\022\n\n\002id\030\001 \001(\003\022\031\n\004" +
"uuid\030\002 \001(\0132\013.proto.UUID\"\230\001\n\022GattCharacte" +
"ristic\022\n\n\002id\030\001 \001(\003\022\031\n\004uuid\030\002 \001(\0132\013.proto" +
".UUID\022\020\n\010can_read\030\003 \001(\010\022\021\n\tcan_write\030\004 \001" +
"(\010\022\"\n\032can_write_without_response\030\005 \001(\010\022\022" +
"\n\ncan_notify\030\006 \001(\010\"7\n\016GattDescriptor\022\n\n\002" +
"id\030\001 \001(\003\022\031\n\004uuid\030\002 \001(\0132\013.proto.UUID\"\025\n\004U" +
"UID\022\r\n\005value\030\001 \001(\t\"6\n\013ServiceData\022\031\n\004uui" +
"d\030\001 \001(\0132\013.proto.UUID\022\014\n\004data\030\002 \001(\014\".\n\033Bl" +
"uetoothLowEnergyException\022\017\n\007message\030\001 \001" +
"(\t*r\n\016BluetoothState\022\037\n\033BLUETOOTH_STATE_" +
"UNSUPPORTED\020\000\022\037\n\033BLUETOOTH_STATE_POWERED" +
"_OFF\020\001\022\036\n\032BLUETOOTH_STATE_POWERED_ON\020\002B." +
"\n*dev.yanshouwang.bluetooth_low_energy.p" +
"rotoP\001b\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
internal_static_proto_Advertisement_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_proto_Advertisement_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_proto_Advertisement_descriptor,
new java.lang.String[] { "Uuid", "Rssi", "Connectable", "Data", "LocalName", "ManufacturerSpecificData", "ServiceDatas", "ServiceUuids", "SolicitedServiceUuids", "TxPowerLevel", "Connectable", "LocalName", "TxPowerLevel", });
internal_static_proto_Peripheral_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_proto_Peripheral_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_proto_Peripheral_descriptor,
new java.lang.String[] { "Id", "MaximumWriteLength", });
internal_static_proto_GattService_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_proto_GattService_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_proto_GattService_descriptor,
new java.lang.String[] { "Id", "Uuid", });
internal_static_proto_GattCharacteristic_descriptor =
getDescriptor().getMessageTypes().get(3);
internal_static_proto_GattCharacteristic_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_proto_GattCharacteristic_descriptor,
new java.lang.String[] { "Id", "Uuid", "CanRead", "CanWrite", "CanWriteWithoutResponse", "CanNotify", });
internal_static_proto_GattDescriptor_descriptor =
getDescriptor().getMessageTypes().get(4);
internal_static_proto_GattDescriptor_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_proto_GattDescriptor_descriptor,
new java.lang.String[] { "Id", "Uuid", });
internal_static_proto_UUID_descriptor =
getDescriptor().getMessageTypes().get(5);
internal_static_proto_UUID_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_proto_UUID_descriptor,
new java.lang.String[] { "Value", });
internal_static_proto_ServiceData_descriptor =
getDescriptor().getMessageTypes().get(6);
internal_static_proto_ServiceData_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_proto_ServiceData_descriptor,
new java.lang.String[] { "Uuid", "Data", });
internal_static_proto_BluetoothLowEnergyException_descriptor =
getDescriptor().getMessageTypes().get(7);
internal_static_proto_BluetoothLowEnergyException_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_proto_BluetoothLowEnergyException_descriptor,
new java.lang.String[] { "Message", });
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -0,0 +1,550 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
/**
* Protobuf type {@code proto.Peripheral}
*/
public final class Peripheral extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:proto.Peripheral)
PeripheralOrBuilder {
private static final long serialVersionUID = 0L;
// Use Peripheral.newBuilder() to construct.
private Peripheral(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Peripheral() {
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new Peripheral();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Peripheral(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
id_ = input.readInt64();
break;
}
case 16: {
maximumWriteLength_ = input.readInt32();
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_Peripheral_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_Peripheral_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.class, dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.Builder.class);
}
public static final int ID_FIELD_NUMBER = 1;
private long id_;
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
@java.lang.Override
public long getId() {
return id_;
}
public static final int MAXIMUM_WRITE_LENGTH_FIELD_NUMBER = 2;
private int maximumWriteLength_;
/**
* <code>int32 maximum_write_length = 2;</code>
* @return The maximumWriteLength.
*/
@java.lang.Override
public int getMaximumWriteLength() {
return maximumWriteLength_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (id_ != 0L) {
output.writeInt64(1, id_);
}
if (maximumWriteLength_ != 0) {
output.writeInt32(2, maximumWriteLength_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (id_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(1, id_);
}
if (maximumWriteLength_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, maximumWriteLength_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof dev.yanshouwang.bluetooth_low_energy.proto.Peripheral)) {
return super.equals(obj);
}
dev.yanshouwang.bluetooth_low_energy.proto.Peripheral other = (dev.yanshouwang.bluetooth_low_energy.proto.Peripheral) obj;
if (getId()
!= other.getId()) return false;
if (getMaximumWriteLength()
!= other.getMaximumWriteLength()) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + ID_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getId());
hash = (37 * hash) + MAXIMUM_WRITE_LENGTH_FIELD_NUMBER;
hash = (53 * hash) + getMaximumWriteLength();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(dev.yanshouwang.bluetooth_low_energy.proto.Peripheral prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code proto.Peripheral}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:proto.Peripheral)
dev.yanshouwang.bluetooth_low_energy.proto.PeripheralOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_Peripheral_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_Peripheral_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.class, dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.Builder.class);
}
// Construct using dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
id_ = 0L;
maximumWriteLength_ = 0;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_Peripheral_descriptor;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.Peripheral getDefaultInstanceForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.getDefaultInstance();
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.Peripheral build() {
dev.yanshouwang.bluetooth_low_energy.proto.Peripheral result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.Peripheral buildPartial() {
dev.yanshouwang.bluetooth_low_energy.proto.Peripheral result = new dev.yanshouwang.bluetooth_low_energy.proto.Peripheral(this);
result.id_ = id_;
result.maximumWriteLength_ = maximumWriteLength_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof dev.yanshouwang.bluetooth_low_energy.proto.Peripheral) {
return mergeFrom((dev.yanshouwang.bluetooth_low_energy.proto.Peripheral)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(dev.yanshouwang.bluetooth_low_energy.proto.Peripheral other) {
if (other == dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.getDefaultInstance()) return this;
if (other.getId() != 0L) {
setId(other.getId());
}
if (other.getMaximumWriteLength() != 0) {
setMaximumWriteLength(other.getMaximumWriteLength());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
dev.yanshouwang.bluetooth_low_energy.proto.Peripheral parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (dev.yanshouwang.bluetooth_low_energy.proto.Peripheral) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private long id_ ;
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
@java.lang.Override
public long getId() {
return id_;
}
/**
* <code>int64 id = 1;</code>
* @param value The id to set.
* @return This builder for chaining.
*/
public Builder setId(long value) {
id_ = value;
onChanged();
return this;
}
/**
* <code>int64 id = 1;</code>
* @return This builder for chaining.
*/
public Builder clearId() {
id_ = 0L;
onChanged();
return this;
}
private int maximumWriteLength_ ;
/**
* <code>int32 maximum_write_length = 2;</code>
* @return The maximumWriteLength.
*/
@java.lang.Override
public int getMaximumWriteLength() {
return maximumWriteLength_;
}
/**
* <code>int32 maximum_write_length = 2;</code>
* @param value The maximumWriteLength to set.
* @return This builder for chaining.
*/
public Builder setMaximumWriteLength(int value) {
maximumWriteLength_ = value;
onChanged();
return this;
}
/**
* <code>int32 maximum_write_length = 2;</code>
* @return This builder for chaining.
*/
public Builder clearMaximumWriteLength() {
maximumWriteLength_ = 0;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:proto.Peripheral)
}
// @@protoc_insertion_point(class_scope:proto.Peripheral)
private static final dev.yanshouwang.bluetooth_low_energy.proto.Peripheral DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new dev.yanshouwang.bluetooth_low_energy.proto.Peripheral();
}
public static dev.yanshouwang.bluetooth_low_energy.proto.Peripheral getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<Peripheral>
PARSER = new com.google.protobuf.AbstractParser<Peripheral>() {
@java.lang.Override
public Peripheral parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Peripheral(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<Peripheral> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Peripheral> getParserForType() {
return PARSER;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.Peripheral getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,21 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public interface PeripheralOrBuilder extends
// @@protoc_insertion_point(interface_extends:proto.Peripheral)
com.google.protobuf.MessageOrBuilder {
/**
* <code>int64 id = 1;</code>
* @return The id.
*/
long getId();
/**
* <code>int32 maximum_write_length = 2;</code>
* @return The maximumWriteLength.
*/
int getMaximumWriteLength();
}

View File

@ -0,0 +1,677 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
/**
* Protobuf type {@code proto.ServiceData}
*/
public final class ServiceData extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:proto.ServiceData)
ServiceDataOrBuilder {
private static final long serialVersionUID = 0L;
// Use ServiceData.newBuilder() to construct.
private ServiceData(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private ServiceData() {
data_ = com.google.protobuf.ByteString.EMPTY;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new ServiceData();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private ServiceData(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder subBuilder = null;
if (uuid_ != null) {
subBuilder = uuid_.toBuilder();
}
uuid_ = input.readMessage(dev.yanshouwang.bluetooth_low_energy.proto.UUID.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(uuid_);
uuid_ = subBuilder.buildPartial();
}
break;
}
case 18: {
data_ = input.readBytes();
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_ServiceData_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_ServiceData_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.class, dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.Builder.class);
}
public static final int UUID_FIELD_NUMBER = 1;
private dev.yanshouwang.bluetooth_low_energy.proto.UUID uuid_;
/**
* <code>.proto.UUID uuid = 1;</code>
* @return Whether the uuid field is set.
*/
@java.lang.Override
public boolean hasUuid() {
return uuid_ != null;
}
/**
* <code>.proto.UUID uuid = 1;</code>
* @return The uuid.
*/
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid() {
return uuid_ == null ? dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder() {
return getUuid();
}
public static final int DATA_FIELD_NUMBER = 2;
private com.google.protobuf.ByteString data_;
/**
* <code>bytes data = 2;</code>
* @return The data.
*/
@java.lang.Override
public com.google.protobuf.ByteString getData() {
return data_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (uuid_ != null) {
output.writeMessage(1, getUuid());
}
if (!data_.isEmpty()) {
output.writeBytes(2, data_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (uuid_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, getUuid());
}
if (!data_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, data_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof dev.yanshouwang.bluetooth_low_energy.proto.ServiceData)) {
return super.equals(obj);
}
dev.yanshouwang.bluetooth_low_energy.proto.ServiceData other = (dev.yanshouwang.bluetooth_low_energy.proto.ServiceData) obj;
if (hasUuid() != other.hasUuid()) return false;
if (hasUuid()) {
if (!getUuid()
.equals(other.getUuid())) return false;
}
if (!getData()
.equals(other.getData())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasUuid()) {
hash = (37 * hash) + UUID_FIELD_NUMBER;
hash = (53 * hash) + getUuid().hashCode();
}
hash = (37 * hash) + DATA_FIELD_NUMBER;
hash = (53 * hash) + getData().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(dev.yanshouwang.bluetooth_low_energy.proto.ServiceData prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code proto.ServiceData}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:proto.ServiceData)
dev.yanshouwang.bluetooth_low_energy.proto.ServiceDataOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_ServiceData_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_ServiceData_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.class, dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.Builder.class);
}
// Construct using dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
if (uuidBuilder_ == null) {
uuid_ = null;
} else {
uuid_ = null;
uuidBuilder_ = null;
}
data_ = com.google.protobuf.ByteString.EMPTY;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_ServiceData_descriptor;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.ServiceData getDefaultInstanceForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.getDefaultInstance();
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.ServiceData build() {
dev.yanshouwang.bluetooth_low_energy.proto.ServiceData result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.ServiceData buildPartial() {
dev.yanshouwang.bluetooth_low_energy.proto.ServiceData result = new dev.yanshouwang.bluetooth_low_energy.proto.ServiceData(this);
if (uuidBuilder_ == null) {
result.uuid_ = uuid_;
} else {
result.uuid_ = uuidBuilder_.build();
}
result.data_ = data_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof dev.yanshouwang.bluetooth_low_energy.proto.ServiceData) {
return mergeFrom((dev.yanshouwang.bluetooth_low_energy.proto.ServiceData)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(dev.yanshouwang.bluetooth_low_energy.proto.ServiceData other) {
if (other == dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.getDefaultInstance()) return this;
if (other.hasUuid()) {
mergeUuid(other.getUuid());
}
if (other.getData() != com.google.protobuf.ByteString.EMPTY) {
setData(other.getData());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
dev.yanshouwang.bluetooth_low_energy.proto.ServiceData parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (dev.yanshouwang.bluetooth_low_energy.proto.ServiceData) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private dev.yanshouwang.bluetooth_low_energy.proto.UUID uuid_;
private com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder> uuidBuilder_;
/**
* <code>.proto.UUID uuid = 1;</code>
* @return Whether the uuid field is set.
*/
public boolean hasUuid() {
return uuidBuilder_ != null || uuid_ != null;
}
/**
* <code>.proto.UUID uuid = 1;</code>
* @return The uuid.
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid() {
if (uuidBuilder_ == null) {
return uuid_ == null ? dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
} else {
return uuidBuilder_.getMessage();
}
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
public Builder setUuid(dev.yanshouwang.bluetooth_low_energy.proto.UUID value) {
if (uuidBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
uuid_ = value;
onChanged();
} else {
uuidBuilder_.setMessage(value);
}
return this;
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
public Builder setUuid(
dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder builderForValue) {
if (uuidBuilder_ == null) {
uuid_ = builderForValue.build();
onChanged();
} else {
uuidBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
public Builder mergeUuid(dev.yanshouwang.bluetooth_low_energy.proto.UUID value) {
if (uuidBuilder_ == null) {
if (uuid_ != null) {
uuid_ =
dev.yanshouwang.bluetooth_low_energy.proto.UUID.newBuilder(uuid_).mergeFrom(value).buildPartial();
} else {
uuid_ = value;
}
onChanged();
} else {
uuidBuilder_.mergeFrom(value);
}
return this;
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
public Builder clearUuid() {
if (uuidBuilder_ == null) {
uuid_ = null;
onChanged();
} else {
uuid_ = null;
uuidBuilder_ = null;
}
return this;
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder getUuidBuilder() {
onChanged();
return getUuidFieldBuilder().getBuilder();
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
public dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder() {
if (uuidBuilder_ != null) {
return uuidBuilder_.getMessageOrBuilder();
} else {
return uuid_ == null ?
dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance() : uuid_;
}
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>
getUuidFieldBuilder() {
if (uuidBuilder_ == null) {
uuidBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
dev.yanshouwang.bluetooth_low_energy.proto.UUID, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder, dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder>(
getUuid(),
getParentForChildren(),
isClean());
uuid_ = null;
}
return uuidBuilder_;
}
private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>bytes data = 2;</code>
* @return The data.
*/
@java.lang.Override
public com.google.protobuf.ByteString getData() {
return data_;
}
/**
* <code>bytes data = 2;</code>
* @param value The data to set.
* @return This builder for chaining.
*/
public Builder setData(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
data_ = value;
onChanged();
return this;
}
/**
* <code>bytes data = 2;</code>
* @return This builder for chaining.
*/
public Builder clearData() {
data_ = getDefaultInstance().getData();
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:proto.ServiceData)
}
// @@protoc_insertion_point(class_scope:proto.ServiceData)
private static final dev.yanshouwang.bluetooth_low_energy.proto.ServiceData DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new dev.yanshouwang.bluetooth_low_energy.proto.ServiceData();
}
public static dev.yanshouwang.bluetooth_low_energy.proto.ServiceData getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<ServiceData>
PARSER = new com.google.protobuf.AbstractParser<ServiceData>() {
@java.lang.Override
public ServiceData parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new ServiceData(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<ServiceData> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<ServiceData> getParserForType() {
return PARSER;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.ServiceData getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,30 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public interface ServiceDataOrBuilder extends
// @@protoc_insertion_point(interface_extends:proto.ServiceData)
com.google.protobuf.MessageOrBuilder {
/**
* <code>.proto.UUID uuid = 1;</code>
* @return Whether the uuid field is set.
*/
boolean hasUuid();
/**
* <code>.proto.UUID uuid = 1;</code>
* @return The uuid.
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUID getUuid();
/**
* <code>.proto.UUID uuid = 1;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder getUuidOrBuilder();
/**
* <code>bytes data = 2;</code>
* @return The data.
*/
com.google.protobuf.ByteString getData();
}

View File

@ -0,0 +1,559 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
/**
* Protobuf type {@code proto.UUID}
*/
public final class UUID extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:proto.UUID)
UUIDOrBuilder {
private static final long serialVersionUID = 0L;
// Use UUID.newBuilder() to construct.
private UUID(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private UUID() {
value_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new UUID();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private UUID(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
java.lang.String s = input.readStringRequireUtf8();
value_ = s;
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_UUID_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_UUID_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.UUID.class, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder.class);
}
public static final int VALUE_FIELD_NUMBER = 1;
private volatile java.lang.Object value_;
/**
* <code>string value = 1;</code>
* @return The value.
*/
@java.lang.Override
public java.lang.String getValue() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
value_ = s;
return s;
}
}
/**
* <code>string value = 1;</code>
* @return The bytes for value.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, value_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, value_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof dev.yanshouwang.bluetooth_low_energy.proto.UUID)) {
return super.equals(obj);
}
dev.yanshouwang.bluetooth_low_energy.proto.UUID other = (dev.yanshouwang.bluetooth_low_energy.proto.UUID) obj;
if (!getValue()
.equals(other.getValue())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + VALUE_FIELD_NUMBER;
hash = (53 * hash) + getValue().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(dev.yanshouwang.bluetooth_low_energy.proto.UUID prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code proto.UUID}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:proto.UUID)
dev.yanshouwang.bluetooth_low_energy.proto.UUIDOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_UUID_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_UUID_fieldAccessorTable
.ensureFieldAccessorsInitialized(
dev.yanshouwang.bluetooth_low_energy.proto.UUID.class, dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder.class);
}
// Construct using dev.yanshouwang.bluetooth_low_energy.proto.UUID.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
value_ = "";
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.Messages.internal_static_proto_UUID_descriptor;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getDefaultInstanceForType() {
return dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance();
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUID build() {
dev.yanshouwang.bluetooth_low_energy.proto.UUID result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUID buildPartial() {
dev.yanshouwang.bluetooth_low_energy.proto.UUID result = new dev.yanshouwang.bluetooth_low_energy.proto.UUID(this);
result.value_ = value_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof dev.yanshouwang.bluetooth_low_energy.proto.UUID) {
return mergeFrom((dev.yanshouwang.bluetooth_low_energy.proto.UUID)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(dev.yanshouwang.bluetooth_low_energy.proto.UUID other) {
if (other == dev.yanshouwang.bluetooth_low_energy.proto.UUID.getDefaultInstance()) return this;
if (!other.getValue().isEmpty()) {
value_ = other.value_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
dev.yanshouwang.bluetooth_low_energy.proto.UUID parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (dev.yanshouwang.bluetooth_low_energy.proto.UUID) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object value_ = "";
/**
* <code>string value = 1;</code>
* @return The value.
*/
public java.lang.String getValue() {
java.lang.Object ref = value_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
value_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string value = 1;</code>
* @return The bytes for value.
*/
public com.google.protobuf.ByteString
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string value = 1;</code>
* @param value The value to set.
* @return This builder for chaining.
*/
public Builder setValue(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
value_ = value;
onChanged();
return this;
}
/**
* <code>string value = 1;</code>
* @return This builder for chaining.
*/
public Builder clearValue() {
value_ = getDefaultInstance().getValue();
onChanged();
return this;
}
/**
* <code>string value = 1;</code>
* @param value The bytes for value to set.
* @return This builder for chaining.
*/
public Builder setValueBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
value_ = value;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:proto.UUID)
}
// @@protoc_insertion_point(class_scope:proto.UUID)
private static final dev.yanshouwang.bluetooth_low_energy.proto.UUID DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new dev.yanshouwang.bluetooth_low_energy.proto.UUID();
}
public static dev.yanshouwang.bluetooth_low_energy.proto.UUID getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<UUID>
PARSER = new com.google.protobuf.AbstractParser<UUID>() {
@java.lang.Override
public UUID parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new UUID(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<UUID> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<UUID> getParserForType() {
return PARSER;
}
@java.lang.Override
public dev.yanshouwang.bluetooth_low_energy.proto.UUID getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,21 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public interface UUIDOrBuilder extends
// @@protoc_insertion_point(interface_extends:proto.UUID)
com.google.protobuf.MessageOrBuilder {
/**
* <code>string value = 1;</code>
* @return The value.
*/
java.lang.String getValue();
/**
* <code>string value = 1;</code>
* @return The bytes for value.
*/
com.google.protobuf.ByteString
getValueBytes();
}

View File

@ -0,0 +1,3 @@
package dev.yanshouwang.bluetooth_low_energy
class BluetoothLowEnergyException(message: String) : Exception(message)

View File

@ -1,599 +1,132 @@
package dev.yanshouwang.bluetooth_low_energy
import android.Manifest
import android.bluetooth.*
import android.bluetooth.le.*
import android.content.BroadcastReceiver
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
import android.bluetooth.BluetoothManager
import android.bluetooth.le.ScanRecord
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageManager
import android.os.Build
import android.os.Handler
import android.os.ParcelUuid
import android.util.Log
import androidx.annotation.NonNull
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.google.protobuf.ByteString
import dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.*
import dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.MessageCategory.*
import dev.yanshouwang.bluetooth_low_energy.pigeon.Api
import dev.yanshouwang.bluetooth_low_energy.proto.BluetoothState
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.embedding.engine.plugins.activity.ActivityAware
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.EventChannel.EventSink
import io.flutter.plugin.common.EventChannel.StreamHandler
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result
import io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener
import java.util.*
const val NAMESPACE = "yanshouwang.dev/bluetooth_low_energy"
typealias StartScanHandler = (code: Int) -> Unit
typealias RequestPermissionsHandler = (granted: Boolean) -> Unit
import java.util.concurrent.Executor
/** BluetoothLowEnergyPlugin */
class BluetoothLowEnergyPlugin : FlutterPlugin, MethodCallHandler, StreamHandler, ActivityAware, RequestPermissionsResultListener {
companion object {
private const val CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb"
private const val BLUETOOTH_ADAPTER_STATE_UNKNOWN = -1
private const val NO_ERROR = 0
private const val REQUEST_CODE = 443
}
private lateinit var method: MethodChannel
private lateinit var event: EventChannel
private lateinit var context: Context
private var binding: ActivityPluginBinding? = null
private var events: EventSink? = null
private val bluetoothAvailable by lazy { context.packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) }
private val bluetoothManager by lazy { context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager }
private val bluetoothAdapter by lazy { bluetoothManager.adapter }
private val handler by lazy { Handler(context.mainLooper) }
private val bluetoothState: BluetoothState
get() {
return if (bluetoothAvailable) bluetoothAdapter.state.messageState
else BluetoothState.UNSUPPORTED
}
private val bluetoothStateReceiver by lazy {
object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
val oldState = intent!!.getIntExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE, BLUETOOTH_ADAPTER_STATE_UNKNOWN).messageState
val newState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BLUETOOTH_ADAPTER_STATE_UNKNOWN).messageState
if (newState == oldState) return
if (newState != BluetoothState.POWERED_ON && scanning) scanning = false
val event = Message.newBuilder()
.setCategory(BLUETOOTH_STATE)
.setState(newState)
.build()
.toByteArray()
events?.success(event)
}
}
}
private val hasPermission
get() = ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
private var requestPermissionsHandler: RequestPermissionsHandler? = null
private var scanCode = NO_ERROR
private var scanning = false
private val scanCallback by lazy {
object : ScanCallback() {
override fun onScanFailed(errorCode: Int) {
super.onScanFailed(errorCode)
scanCode = errorCode
}
override fun onScanResult(callbackType: Int, result: ScanResult?) {
super.onScanResult(callbackType, result)
if (result == null) return
val record = result.scanRecord
val advertisements =
if (record == null) ByteString.EMPTY
else ByteString.copyFrom(record.bytes)
// TODO: We can't get connectable value before Android 8.0, here we just return true
// remove this useless code after the minSdkVersion set to 26 or later.
val connectable =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) result.isConnectable
else true
val builder = Discovery.newBuilder()
.setUuid(result.device.uuid)
.setRssi(result.rssi)
.setAdvertisements(advertisements)
.setConnectable(connectable)
val discovery = builder.build()
val event = Message.newBuilder()
.setCategory(CENTRAL_DISCOVERED)
.setDiscovery(discovery)
.build()
.toByteArray()
events?.success(event)
}
override fun onBatchScanResults(results: MutableList<ScanResult>?) {
super.onBatchScanResults(results)
if (results == null) return
for (result in results) {
val record = result.scanRecord
val advertisements =
if (record == null) ByteString.EMPTY
else ByteString.copyFrom(record.bytes)
// TODO: We can't get connectable value before Android 8.0, here we just return true
// remove this useless code after the minSdkVersion set to 26 or later.
val connectable =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) result.isConnectable
else true
val builder = Discovery.newBuilder()
.setUuid(result.device.uuid)
.setRssi(result.rssi)
.setAdvertisements(advertisements)
.setConnectable(connectable)
val discovery = builder.build()
val event = Message.newBuilder()
.setCategory(CENTRAL_DISCOVERED)
.setDiscovery(discovery)
.build()
.toByteArray()
events?.success(event)
}
}
}
}
private val nativeGATTs by lazy { mutableMapOf<String, NativeGATT>() }
private val connects by lazy { mutableMapOf<BluetoothGatt, Result>() }
private val maximumWriteLengths by lazy { mutableMapOf<BluetoothGatt, Int>() }
private val disconnects by lazy { mutableMapOf<BluetoothGatt, Result>() }
private val characteristicReads by lazy { mutableMapOf<BluetoothGattCharacteristic, Result>() }
private val characteristicWrites by lazy { mutableMapOf<BluetoothGattCharacteristic, Result>() }
private val descriptorReads by lazy { mutableMapOf<BluetoothGattDescriptor, Result>() }
private val descriptorWrites by lazy { mutableMapOf<BluetoothGattDescriptor, Result>() }
private val bluetoothGattCallback by lazy {
object : BluetoothGattCallback() {
override fun onConnectionStateChange(gatt: BluetoothGatt?, status: Int, newState: Int) {
super.onConnectionStateChange(gatt, status, newState)
when (status) {
BluetoothGatt.GATT_SUCCESS -> {
when (newState) {
BluetoothProfile.STATE_DISCONNECTED -> {
// Maybe disconnect succeed, connect failed, or connection lost when an adaptor closed event triggered.
gatt!!.close()
val connect = connects.remove(gatt)
if (connect != null) handler.post { connect.error("GATT error with status: $status.", null, null) }
else {
val nativeGATT = nativeGATTs.entries.first { entry -> entry.value.value === gatt }
nativeGATTs.remove(nativeGATT.key)
val disconnect = disconnects.remove(gatt)
if (disconnect != null) handler.post { disconnect.success() }
else {
val connectionLost = GattConnectionLost.newBuilder()
.setKey(nativeGATT.key)
.setError("GATT error with status: $status")
.build()
val event = Message.newBuilder()
.setCategory(GATT_CONNECTION_LOST)
.setConnectionLost(connectionLost)
.build()
.toByteArray()
handler.post { events?.success(event) }
}
}
}
BluetoothProfile.STATE_CONNECTED -> {
// Must be connect succeed.
val requested = gatt!!.requestMtu(512)
if (!requested) gatt.disconnect()
}
else -> throw NotImplementedError() // should never be called.
}
}
else -> {
// Maybe connect failed, disconnect failed or connection lost.
gatt!!.close()
val connect = connects.remove(gatt)
if (connect != null) handler.post { connect.error("GATT error with status: $status", null, null) }
else {
val nativeGATT = nativeGATTs.entries.first { entry -> entry.value.value === gatt }
nativeGATTs.remove(nativeGATT.key)
val disconnect = disconnects.remove(gatt)
if (disconnect != null) handler.post { disconnect.error("GATT error with status: $status", null, null) }
else {
val connectionLost = GattConnectionLost.newBuilder()
.setKey(nativeGATT.key)
.setError("GATT error with status: $status")
.build()
val event = Message.newBuilder()
.setCategory(GATT_CONNECTION_LOST)
.setConnectionLost(connectionLost)
.build()
.toByteArray()
handler.post { events?.success(event) }
}
}
}
}
}
override fun onMtuChanged(gatt: BluetoothGatt?, mtu: Int, status: Int) {
super.onMtuChanged(gatt, mtu, status)
when (status) {
BluetoothGatt.GATT_SUCCESS -> {
val discovered = gatt!!.discoverServices()
if (discovered) maximumWriteLengths[gatt] = mtu - 3
else gatt.disconnect()
}
else -> gatt!!.disconnect()
}
}
override fun onServicesDiscovered(gatt: BluetoothGatt?, status: Int) {
super.onServicesDiscovered(gatt, status)
val maximumWriteLength = maximumWriteLengths.remove(gatt)!!
when (status) {
BluetoothGatt.GATT_SUCCESS -> {
val nativeServices = mutableMapOf<String, NativeGattService>()
val messageServices = mutableListOf<GattService>()
for (service in gatt!!.services) {
val nativeCharacteristics = mutableMapOf<String, NativeGattCharacteristic>()
val messageCharacteristics = mutableListOf<GattCharacteristic>()
for (characteristic in service.characteristics) {
val nativeDescriptors = mutableMapOf<String, NativeGattDescriptor>()
val messageDescriptors = mutableListOf<GattDescriptor>()
for (descriptor in characteristic.descriptors) {
// Add native descriptor.
val nativeDescriptor = NativeGattDescriptor(descriptor)
nativeDescriptors[nativeDescriptor.key] = nativeDescriptor
// Add message descriptor.
val descriptorUUID = descriptor.uuid.toString()
val messageDescriptor = GattDescriptor.newBuilder()
.setKey(nativeDescriptor.key)
.setUuid(descriptorUUID)
.build()
messageDescriptors.add(messageDescriptor)
}
// Add native characteristic.
val nativeCharacteristic = NativeGattCharacteristic(characteristic, nativeDescriptors)
nativeCharacteristics[nativeCharacteristic.key] = nativeCharacteristic
// Add message characteristic.
val characteristicUUID = characteristic.uuid.toString()
val canRead = characteristic.properties and BluetoothGattCharacteristic.PROPERTY_READ != 0
val canWrite = characteristic.properties and BluetoothGattCharacteristic.PROPERTY_WRITE != 0
val canWriteWithoutResponse = characteristic.properties and BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE != 0
val canNotify = characteristic.properties and BluetoothGattCharacteristic.PROPERTY_NOTIFY != 0
val messageCharacteristic = GattCharacteristic.newBuilder()
.setKey(nativeCharacteristic.key)
.setUuid(characteristicUUID)
.setCanRead(canRead)
.setCanWrite(canWrite)
.setCanWriteWithoutResponse(canWriteWithoutResponse)
.setCanNotify(canNotify)
.addAllDescriptors(messageDescriptors)
.build()
messageCharacteristics.add(messageCharacteristic)
}
// Add native service.
val nativeService = NativeGattService(service, nativeCharacteristics)
nativeServices[nativeService.key] = nativeService
// Add message service.
val serviceUUID = service.uuid.toString()
val messageService = GattService.newBuilder()
.setKey(nativeService.key)
.setUuid(serviceUUID)
.addAllCharacteristics(messageCharacteristics)
.build()
messageServices.add(messageService)
}
// Add native gatt.
val nativeGATT = NativeGATT(gatt, nativeServices)
nativeGATTs[nativeGATT.key] = nativeGATT
// Add message gatt.
val reply = GATT.newBuilder()
.setKey(nativeGATT.key)
.setMaximumWriteLength(maximumWriteLength)
.addAllServices(messageServices)
.build()
.toByteArray()
val connect = connects.remove(gatt)!!
handler.post { connect.success(reply) }
}
else -> gatt!!.disconnect()
}
}
override fun onCharacteristicRead(gatt: BluetoothGatt?, characteristic: BluetoothGattCharacteristic?, status: Int) {
super.onCharacteristicRead(gatt, characteristic, status)
val read = characteristicReads.remove(characteristic)!!
when (status) {
BluetoothGatt.GATT_SUCCESS -> handler.post { read.success(characteristic!!.value) }
else -> handler.post { read.error("GATT error with status: $status", null, null) }
}
}
override fun onCharacteristicWrite(gatt: BluetoothGatt?, characteristic: BluetoothGattCharacteristic?, status: Int) {
super.onCharacteristicWrite(gatt, characteristic, status)
val write = characteristicWrites.remove(characteristic)!!
when (status) {
BluetoothGatt.GATT_SUCCESS -> handler.post { write.success() }
else -> handler.post { write.error("GATT error with status: $status", null, null) }
}
}
override fun onCharacteristicChanged(gatt: BluetoothGatt?, characteristic: BluetoothGattCharacteristic?) {
super.onCharacteristicChanged(gatt, characteristic)
val nativeGATT = nativeGATTs.values.first { entry -> entry.value === gatt }
val nativeService = nativeGATT.services.values.first { entry -> entry.value === characteristic!!.service }
val nativeCharacteristic = nativeService.characteristics.values.first { entry -> entry.value === characteristic }
val value = ByteString.copyFrom(characteristic!!.value)
val characteristicValue = GattCharacteristicValue.newBuilder()
.setGattKey(nativeGATT.key)
.setServiceKey(nativeService.key)
.setKey(nativeCharacteristic.key)
.setValue(value)
.build()
val event = Message.newBuilder()
.setCategory(GATT_CHARACTERISTIC_NOTIFY)
.setCharacteristicValue(characteristicValue)
.build()
.toByteArray()
handler.post { events?.success(event) }
}
override fun onDescriptorRead(gatt: BluetoothGatt?, descriptor: BluetoothGattDescriptor?, status: Int) {
super.onDescriptorRead(gatt, descriptor, status)
val read = descriptorReads.remove(descriptor)!!
when (status) {
BluetoothGatt.GATT_SUCCESS -> handler.post { read.success(descriptor!!.value) }
else -> handler.post { read.error("GATT error with status: $status", null, null) }
}
}
override fun onDescriptorWrite(gatt: BluetoothGatt?, descriptor: BluetoothGattDescriptor?, status: Int) {
super.onDescriptorWrite(gatt, descriptor, status)
val write = descriptorWrites.remove(descriptor)!!
when (status) {
BluetoothGatt.GATT_SUCCESS -> handler.post { write.success() }
else -> handler.post { write.error("GATT error with status: $status", null, null) }
}
}
}
}
private fun startScan(services: List<String>, startScanHandler: StartScanHandler) {
val filters = services.map { service ->
val serviceUUID = ParcelUuid.fromString(service)
ScanFilter.Builder()
.setServiceUuid(serviceUUID)
.build()
}
val settings = ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
.build()
bluetoothAdapter.bluetoothLeScanner.startScan(filters, settings, scanCallback)
// use handler.post to delay until #onScanFailed executed.
handler.post {
val code = scanCode
when (code) {
NO_ERROR -> scanning = true
else -> scanCode = NO_ERROR
}
startScanHandler.invoke(code)
}
}
private fun stopScan() {
bluetoothAdapter.bluetoothLeScanner.stopScan(scanCallback)
scanning = false
}
class BluetoothLowEnergyPlugin : FlutterPlugin, ActivityAware {
override fun onAttachedToEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
method = MethodChannel(binding.binaryMessenger, "$NAMESPACE/method")
method.setMethodCallHandler(this)
event = EventChannel(binding.binaryMessenger, "$NAMESPACE/event")
event.setStreamHandler(this)
context = binding.applicationContext
// Register bluetooth adapter state receiver.
val adapterStateFilter = IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED)
context.registerReceiver(bluetoothStateReceiver, adapterStateFilter)
val binaryMessenger = binding.binaryMessenger
items[KEY_CENTRAL_MANAGER_FLUTTER_API] = Api.CentralManagerFlutterApi(binaryMessenger)
items[KEY_PERIPHERAL_FLUTTER_API] = Api.PeripheralFlutterApi(binaryMessenger)
items[KEY_GATT_CHARACTERISTIC_FLUTTER_API] = Api.GattCharacteristicFlutterApi(binaryMessenger)
Api.CentralManagerHostApi.setup(binaryMessenger, MyCentralManagerHostApi)
Api.PeripheralHostApi.setup(binaryMessenger, MyPeripheralHostApi)
Api.GattServiceHostApi.setup(binaryMessenger, MyGattServiceHostApi)
Api.GattCharacteristicHostApi.setup(binaryMessenger, MyGattCharacteristicHostApi)
Api.GattDescriptorHostApi.setup(binaryMessenger, MyGattDescriptorHostApi)
}
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
// Clear connections.
for (nativeGATT in nativeGATTs.values) nativeGATT.value.disconnect()
// Stop scan.
if (scanning) stopScan()
// Unregister bluetooth adapter state receiver.
context.unregisterReceiver(bluetoothStateReceiver)
event.setStreamHandler(null)
method.setMethodCallHandler(null)
}
val binaryMessenger = binding.binaryMessenger
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
val data = call.arguments<ByteArray>()
val command = Message.parseFrom(data)
when (command.category!!) {
BLUETOOTH_STATE -> result.success(bluetoothState.number)
CENTRAL_START_DISCOVERY -> {
val startDiscovery = Runnable {
val services = command.startDiscoveryArguments.servicesList
val startScanHandler: StartScanHandler = { code ->
when (code) {
NO_ERROR -> result.success()
else -> result.error("Discovery start failed with code: $code", null, null)
}
}
startScan(services, startScanHandler)
}
when {
hasPermission -> startDiscovery.run()
else -> {
requestPermissionsHandler = { granted ->
if (granted) startDiscovery.run()
else result.error("Discovery start failed because `ACCESS_FINE_LOCATION` was denied by user.", null, null)
}
val permissions = arrayOf(Manifest.permission.ACCESS_FINE_LOCATION)
ActivityCompat.requestPermissions(binding!!.activity, permissions, REQUEST_CODE)
}
}
}
CENTRAL_STOP_DISCOVERY -> {
stopScan()
result.success()
}
CENTRAL_CONNECT -> {
val device = bluetoothAdapter.getRemoteDevice(command.connectArguments.uuid.address)
val gatt = when {
// Use TRANSPORT_LE to avoid none flag device on Android 23 or later.
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> device.connectGatt(context, false, bluetoothGattCallback, BluetoothDevice.TRANSPORT_LE)
else -> device.connectGatt(context, false, bluetoothGattCallback)
}
connects[gatt] = result
}
GATT_DISCONNECT -> {
val nativeGATT = nativeGATTs[command.disconnectArguments.key]!!
disconnects[nativeGATT.value] = result
nativeGATT.value.disconnect()
}
GATT_CHARACTERISTIC_READ -> {
val nativeGATT = nativeGATTs[command.characteristicReadArguments.gattKey]!!
val nativeService = nativeGATT.services[command.characteristicReadArguments.serviceKey]!!
val nativeCharacteristic = nativeService.characteristics[command.characteristicReadArguments.key]!!
val read = nativeGATT.value.readCharacteristic(nativeCharacteristic.value)
if (read) characteristicReads[nativeCharacteristic.value] = result
else result.error("Characteristic read failed.", null, null)
}
GATT_CHARACTERISTIC_WRITE -> {
val nativeGATT = nativeGATTs[command.characteristicWriteArguments.gattKey]!!
val nativeService = nativeGATT.services[command.characteristicWriteArguments.serviceKey]!!
val nativeCharacteristic = nativeService.characteristics[command.characteristicWriteArguments.key]!!
nativeCharacteristic.value.writeType =
if (command.characteristicWriteArguments.withoutResponse) BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE
else BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT
nativeCharacteristic.value.value = command.characteristicWriteArguments.value.toByteArray()
val written = nativeGATT.value.writeCharacteristic(nativeCharacteristic.value)
if (written) characteristicWrites[nativeCharacteristic.value] = result
else result.error("Characteristic write failed.", null, null)
}
GATT_CHARACTERISTIC_NOTIFY -> {
val nativeGATT = nativeGATTs[command.characteristicNotifyArguments.gattKey]!!
val nativeService = nativeGATT.services[command.characteristicNotifyArguments.serviceKey]!!
val nativeCharacteristic = nativeService.characteristics[command.characteristicNotifyArguments.key]!!
val descriptorUUID = UUID.fromString(CLIENT_CHARACTERISTIC_CONFIG)
val descriptor = nativeCharacteristic.value.getDescriptor(descriptorUUID)
val notified = nativeGATT.value.setCharacteristicNotification(nativeCharacteristic.value, command.characteristicNotifyArguments.state)
if (notified) {
descriptor.value =
if (command.characteristicNotifyArguments.state) BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
else BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE
val written = nativeGATT.value.writeDescriptor(descriptor)
if (written) descriptorWrites[descriptor] = result
else result.error("Client characteristic config descriptor write failed.", null, null)
} else result.error("Characteristic Notify failed.", null, null)
}
GATT_DESCRIPTOR_READ -> {
val nativeGATT = nativeGATTs[command.descriptorReadArguments.gattKey]!!
val nativeService = nativeGATT.services[command.descriptorReadArguments.serviceKey]!!
val nativeCharacteristic = nativeService.characteristics[command.descriptorReadArguments.characteristicKey]!!
val nativeDescriptor = nativeCharacteristic.descriptors[command.descriptorReadArguments.key]!!
val read = nativeGATT.value.readDescriptor(nativeDescriptor.value)
if (read) descriptorReads[nativeDescriptor.value] = result
else result.error("Descriptor read failed.", null, null)
}
GATT_DESCRIPTOR_WRITE -> {
val nativeGATT = nativeGATTs[command.descriptorWriteArguments.gattKey]!!
val nativeService = nativeGATT.services[command.descriptorWriteArguments.serviceKey]!!
val nativeCharacteristic = nativeService.characteristics[command.descriptorWriteArguments.characteristicKey]!!
val nativeDescriptor = nativeCharacteristic.descriptors[command.descriptorWriteArguments.key]!!
nativeDescriptor.value.value = command.descriptorWriteArguments.value.toByteArray()
val written = nativeGATT.value.writeDescriptor(nativeDescriptor.value)
if (written) descriptorWrites[nativeDescriptor.value] = result
else result.error("Descriptor write failed.", null, null)
}
else -> result.notImplemented()
}
}
items.remove(KEY_CENTRAL_MANAGER_FLUTTER_API)
items.remove(KEY_PERIPHERAL_FLUTTER_API)
items.remove(KEY_GATT_CHARACTERISTIC_FLUTTER_API)
override fun onListen(arguments: Any?, events: EventSink?) {
Log.d(TAG, "onListen")
this.events = events
}
override fun onCancel(arguments: Any?) {
Log.d(TAG, "onCancel")
// This must be a hot reload for now, clear all status here.
// Clear connections.
for (nativeGATT in nativeGATTs.values) nativeGATT.value.disconnect()
// Stop scan.
if (scanning) stopScan()
events = null
Api.CentralManagerHostApi.setup(binaryMessenger, null)
Api.PeripheralHostApi.setup(binaryMessenger, null)
Api.GattServiceHostApi.setup(binaryMessenger, null)
Api.GattCharacteristicHostApi.setup(binaryMessenger, null)
Api.GattDescriptorHostApi.setup(binaryMessenger, null)
}
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
this.binding = binding
this.binding!!.addRequestPermissionsResultListener(this)
}
override fun onDetachedFromActivity() {
binding!!.removeRequestPermissionsResultListener(this)
binding = null
}
override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) {
onAttachedToActivity(binding)
items[KEY_ACTIVITY_PLUGIN_BINDING] = binding
binding.addRequestPermissionsResultListener(MyRequestPermissionsResultListener)
}
override fun onDetachedFromActivityForConfigChanges() {
onDetachedFromActivity()
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>?, grantResults: IntArray?): Boolean {
return when {
requestCode != REQUEST_CODE || requestPermissionsHandler == null -> false
else -> {
val granted =
grantResults != null && grantResults.all { result -> result == PackageManager.PERMISSION_GRANTED }
requestPermissionsHandler!!.invoke(granted)
requestPermissionsHandler = null
true
}
}
override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) {
onAttachedToActivity(binding)
}
override fun onDetachedFromActivity() {
val binding = items.remove(KEY_ACTIVITY_PLUGIN_BINDING) as ActivityPluginBinding
binding.removeRequestPermissionsResultListener(MyRequestPermissionsResultListener)
}
}
val Any.TAG: String
get() = this::class.java.simpleName
const val KEY_CENTRAL_MANAGER_FLUTTER_API = "KEY_CENTRAL_MANAGER_FLUTTER_API"
const val KEY_PERIPHERAL_FLUTTER_API = "KEY_PERIPHERAL_FLUTTER_API"
const val KEY_GATT_CHARACTERISTIC_FLUTTER_API = "KEY_GATT_CHARACTERISTIC_FLUTTER_API"
const val KEY_ACTIVITY_PLUGIN_BINDING = "KEY_ACTIVITY_PLUGIN_BINDING"
const val REQUEST_CODE = 443
const val KEY_AUTHORIZE_RESULT = "KEY_AUTHORIZE_RESULT"
const val KEY_START_SCAN_ERROR = "KEY_START_SCAN_ERROR"
const val KEY_CONNECT_RESULT = "KEY_CONNECT_RESULT"
const val KEY_DISCONNECT_RESULT = "KEY_DISCONNECT_RESULT"
const val KEY_DISCOVER_SERVICES_RESULT = "KEY_DISCOVER_SERVICES_RESULT"
const val KEY_READ_RESULT = "KEY_READ_RESULT"
const val KEY_WRITE_RESULT = "KEY_WRITE_RESULT"
const val DATA_TYPE_MANUFACTURER_SPECIFIC_DATA = 0xFF;
fun Result.success() {
success(null)
}
val items = mutableMapOf<String, Any>()
val instances = mutableMapOf<Long, Any>()
val identifiers = mutableMapOf<Any, Long>()
val Int.messageState: BluetoothState
val activity get() = (items[KEY_ACTIVITY_PLUGIN_BINDING] as ActivityPluginBinding).activity
val centralFlutterApi get() = items[KEY_CENTRAL_MANAGER_FLUTTER_API] as Api.CentralManagerFlutterApi
val peripheralFlutterApi get() = items[KEY_PERIPHERAL_FLUTTER_API] as Api.PeripheralFlutterApi
val characteristicFlutterApi get() = items[KEY_GATT_CHARACTERISTIC_FLUTTER_API] as Api.GattCharacteristicFlutterApi
val bluetoothManager get() = activity.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
val bluetoothAdapter get() = bluetoothManager.adapter as BluetoothAdapter
val bluetoothAvailable get() = activity.packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)
val mainHandler get() = Handler(activity.mainLooper)
val mainExecutor: Executor get() = ContextCompat.getMainExecutor(activity)
val Int.bluetoothState
get() = when (this) {
BluetoothAdapter.STATE_OFF -> BluetoothState.POWERED_OFF
BluetoothAdapter.STATE_TURNING_ON -> BluetoothState.POWERED_OFF
BluetoothAdapter.STATE_ON -> BluetoothState.POWERED_ON
BluetoothAdapter.STATE_TURNING_OFF -> BluetoothState.POWERED_ON
else -> BluetoothState.UNRECOGNIZED
BluetoothAdapter.STATE_OFF -> BluetoothState.BLUETOOTH_STATE_POWERED_OFF
BluetoothAdapter.STATE_TURNING_ON -> BluetoothState.BLUETOOTH_STATE_POWERED_OFF
BluetoothAdapter.STATE_ON -> BluetoothState.BLUETOOTH_STATE_POWERED_ON
BluetoothAdapter.STATE_TURNING_OFF -> BluetoothState.BLUETOOTH_STATE_POWERED_ON
else -> throw IllegalArgumentException()
}
val BluetoothDevice.uuid: String
val BluetoothDevice.uuidString: String
get() {
val node = address.filter { char -> char != ':' }.lowercase()
// We don't known the timestamp of the bluetooth device, use nil UUID as prefix.
return "00000000-0000-0000-0000-$node"
// We don't know the timestamp of the bluetooth device, use nil UUID as prefix.
return "00000000-0000-0000-$node"
}
val String.address: String
get() = takeLast(12).chunked(2).joinToString(":").uppercase()
val ScanRecord.rawManufacturerSpecificData: ByteArray?
get() {
var offset = 0;
while (offset < bytes.size) {
val length = bytes[offset++].toInt() and 0xff
if (length == 0) {
break
}
val end = offset + length
val type = bytes[offset++].toInt() and 0xff
if (type == DATA_TYPE_MANUFACTURER_SPECIFIC_DATA) {
return bytes.slice(offset until end).toByteArray()
}
offset = end
}
return null
}

View File

@ -1,45 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun connectArguments(block: dev.yanshouwang.bluetooth_low_energy.ConnectArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.ConnectArguments =
dev.yanshouwang.bluetooth_low_energy.ConnectArgumentsKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.ConnectArguments.newBuilder()).apply { block() }._build()
object ConnectArgumentsKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.ConnectArguments.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.ConnectArguments.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.ConnectArguments = _builder.build()
/**
* <code>string uuid = 1;</code>
*/
var uuid: kotlin.String
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>string uuid = 1;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.ConnectArguments.copy(block: dev.yanshouwang.bluetooth_low_energy.ConnectArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.ConnectArguments =
dev.yanshouwang.bluetooth_low_energy.ConnectArgumentsKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,96 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun discovery(block: dev.yanshouwang.bluetooth_low_energy.DiscoveryKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Discovery =
dev.yanshouwang.bluetooth_low_energy.DiscoveryKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Discovery.newBuilder()).apply { block() }._build()
object DiscoveryKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Discovery.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Discovery.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Discovery = _builder.build()
/**
* <code>string uuid = 1;</code>
*/
var uuid: kotlin.String
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>string uuid = 1;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
/**
* <code>sint32 rssi = 2;</code>
*/
var rssi: kotlin.Int
@JvmName("getRssi")
get() = _builder.getRssi()
@JvmName("setRssi")
set(value) {
_builder.setRssi(value)
}
/**
* <code>sint32 rssi = 2;</code>
*/
fun clearRssi() {
_builder.clearRssi()
}
/**
* <code>bytes advertisements = 3;</code>
*/
var advertisements: com.google.protobuf.ByteString
@JvmName("getAdvertisements")
get() = _builder.getAdvertisements()
@JvmName("setAdvertisements")
set(value) {
_builder.setAdvertisements(value)
}
/**
* <code>bytes advertisements = 3;</code>
*/
fun clearAdvertisements() {
_builder.clearAdvertisements()
}
/**
* <code>bool connectable = 4;</code>
*/
var connectable: kotlin.Boolean
@JvmName("getConnectable")
get() = _builder.getConnectable()
@JvmName("setConnectable")
set(value) {
_builder.setConnectable(value)
}
/**
* <code>bool connectable = 4;</code>
*/
fun clearConnectable() {
_builder.clearConnectable()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Discovery.copy(block: dev.yanshouwang.bluetooth_low_energy.DiscoveryKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Discovery =
dev.yanshouwang.bluetooth_low_energy.DiscoveryKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,125 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gATT(block: dev.yanshouwang.bluetooth_low_energy.GATTKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GATT =
dev.yanshouwang.bluetooth_low_energy.GATTKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GATT.newBuilder()).apply { block() }._build()
object GATTKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GATT.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GATT.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GATT = _builder.build()
/**
* <code>string key = 1;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 1;</code>
*/
fun clearKey() {
_builder.clearKey()
}
/**
* <code>int32 maximumWriteLength = 2;</code>
*/
var maximumWriteLength: kotlin.Int
@JvmName("getMaximumWriteLength")
get() = _builder.getMaximumWriteLength()
@JvmName("setMaximumWriteLength")
set(value) {
_builder.setMaximumWriteLength(value)
}
/**
* <code>int32 maximumWriteLength = 2;</code>
*/
fun clearMaximumWriteLength() {
_builder.clearMaximumWriteLength()
}
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
class ServicesProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattService services = 3;</code>
*/
val services: com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService, ServicesProxy>
@kotlin.jvm.JvmSynthetic
get() = com.google.protobuf.kotlin.DslList(
_builder.getServicesList()
)
/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattService services = 3;</code>
* @param value The services to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addServices")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService, ServicesProxy>.add(value: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService) {
_builder.addServices(value)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattService services = 3;</code>
* @param value The services to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignServices")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService, ServicesProxy>.plusAssign(value: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService) {
add(value)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattService services = 3;</code>
* @param values The services to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllServices")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService, ServicesProxy>.addAll(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService>) {
_builder.addAllServices(values)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattService services = 3;</code>
* @param values The services to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllServices")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService, ServicesProxy>.plusAssign(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService>) {
addAll(values)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattService services = 3;</code>
* @param index The index to set the value at.
* @param value The services to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setServices")
operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService, ServicesProxy>.set(index: kotlin.Int, value: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService) {
_builder.setServices(index, value)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattService services = 3;</code>
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearServices")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService, ServicesProxy>.clear() {
_builder.clearServices()
}}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GATT.copy(block: dev.yanshouwang.bluetooth_low_energy.GATTKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GATT =
dev.yanshouwang.bluetooth_low_energy.GATTKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,193 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattCharacteristic(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic.newBuilder()).apply { block() }._build()
object GattCharacteristicKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic = _builder.build()
/**
* <code>string key = 1;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 1;</code>
*/
fun clearKey() {
_builder.clearKey()
}
/**
* <code>string uuid = 2;</code>
*/
var uuid: kotlin.String
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>string uuid = 2;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
/**
* <code>bool canRead = 3;</code>
*/
var canRead: kotlin.Boolean
@JvmName("getCanRead")
get() = _builder.getCanRead()
@JvmName("setCanRead")
set(value) {
_builder.setCanRead(value)
}
/**
* <code>bool canRead = 3;</code>
*/
fun clearCanRead() {
_builder.clearCanRead()
}
/**
* <code>bool canWrite = 4;</code>
*/
var canWrite: kotlin.Boolean
@JvmName("getCanWrite")
get() = _builder.getCanWrite()
@JvmName("setCanWrite")
set(value) {
_builder.setCanWrite(value)
}
/**
* <code>bool canWrite = 4;</code>
*/
fun clearCanWrite() {
_builder.clearCanWrite()
}
/**
* <code>bool canWriteWithoutResponse = 5;</code>
*/
var canWriteWithoutResponse: kotlin.Boolean
@JvmName("getCanWriteWithoutResponse")
get() = _builder.getCanWriteWithoutResponse()
@JvmName("setCanWriteWithoutResponse")
set(value) {
_builder.setCanWriteWithoutResponse(value)
}
/**
* <code>bool canWriteWithoutResponse = 5;</code>
*/
fun clearCanWriteWithoutResponse() {
_builder.clearCanWriteWithoutResponse()
}
/**
* <code>bool canNotify = 6;</code>
*/
var canNotify: kotlin.Boolean
@JvmName("getCanNotify")
get() = _builder.getCanNotify()
@JvmName("setCanNotify")
set(value) {
_builder.setCanNotify(value)
}
/**
* <code>bool canNotify = 6;</code>
*/
fun clearCanNotify() {
_builder.clearCanNotify()
}
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
class DescriptorsProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattDescriptor descriptors = 7;</code>
*/
val descriptors: com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor, DescriptorsProxy>
@kotlin.jvm.JvmSynthetic
get() = com.google.protobuf.kotlin.DslList(
_builder.getDescriptorsList()
)
/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattDescriptor descriptors = 7;</code>
* @param value The descriptors to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addDescriptors")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor, DescriptorsProxy>.add(value: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor) {
_builder.addDescriptors(value)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattDescriptor descriptors = 7;</code>
* @param value The descriptors to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignDescriptors")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor, DescriptorsProxy>.plusAssign(value: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor) {
add(value)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattDescriptor descriptors = 7;</code>
* @param values The descriptors to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllDescriptors")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor, DescriptorsProxy>.addAll(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor>) {
_builder.addAllDescriptors(values)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattDescriptor descriptors = 7;</code>
* @param values The descriptors to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllDescriptors")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor, DescriptorsProxy>.plusAssign(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor>) {
addAll(values)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattDescriptor descriptors = 7;</code>
* @param index The index to set the value at.
* @param value The descriptors to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setDescriptors")
operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor, DescriptorsProxy>.set(index: kotlin.Int, value: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor) {
_builder.setDescriptors(index, value)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattDescriptor descriptors = 7;</code>
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearDescriptors")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor, DescriptorsProxy>.clear() {
_builder.clearDescriptors()
}}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic.copy(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,96 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattCharacteristicNotifyArguments(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicNotifyArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicNotifyArguments =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicNotifyArgumentsKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicNotifyArguments.newBuilder()).apply { block() }._build()
object GattCharacteristicNotifyArgumentsKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicNotifyArguments.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicNotifyArguments.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicNotifyArguments = _builder.build()
/**
* <code>string gatt_key = 1;</code>
*/
var gattKey: kotlin.String
@JvmName("getGattKey")
get() = _builder.getGattKey()
@JvmName("setGattKey")
set(value) {
_builder.setGattKey(value)
}
/**
* <code>string gatt_key = 1;</code>
*/
fun clearGattKey() {
_builder.clearGattKey()
}
/**
* <code>string service_key = 2;</code>
*/
var serviceKey: kotlin.String
@JvmName("getServiceKey")
get() = _builder.getServiceKey()
@JvmName("setServiceKey")
set(value) {
_builder.setServiceKey(value)
}
/**
* <code>string service_key = 2;</code>
*/
fun clearServiceKey() {
_builder.clearServiceKey()
}
/**
* <code>string key = 3;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 3;</code>
*/
fun clearKey() {
_builder.clearKey()
}
/**
* <code>bool state = 4;</code>
*/
var state: kotlin.Boolean
@JvmName("getState")
get() = _builder.getState()
@JvmName("setState")
set(value) {
_builder.setState(value)
}
/**
* <code>bool state = 4;</code>
*/
fun clearState() {
_builder.clearState()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicNotifyArguments.copy(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicNotifyArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicNotifyArguments =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicNotifyArgumentsKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,79 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattCharacteristicReadArguments(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicReadArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicReadArguments =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicReadArgumentsKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicReadArguments.newBuilder()).apply { block() }._build()
object GattCharacteristicReadArgumentsKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicReadArguments.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicReadArguments.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicReadArguments = _builder.build()
/**
* <code>string gatt_key = 1;</code>
*/
var gattKey: kotlin.String
@JvmName("getGattKey")
get() = _builder.getGattKey()
@JvmName("setGattKey")
set(value) {
_builder.setGattKey(value)
}
/**
* <code>string gatt_key = 1;</code>
*/
fun clearGattKey() {
_builder.clearGattKey()
}
/**
* <code>string service_key = 2;</code>
*/
var serviceKey: kotlin.String
@JvmName("getServiceKey")
get() = _builder.getServiceKey()
@JvmName("setServiceKey")
set(value) {
_builder.setServiceKey(value)
}
/**
* <code>string service_key = 2;</code>
*/
fun clearServiceKey() {
_builder.clearServiceKey()
}
/**
* <code>string key = 3;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 3;</code>
*/
fun clearKey() {
_builder.clearKey()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicReadArguments.copy(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicReadArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicReadArguments =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicReadArgumentsKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,96 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattCharacteristicValue(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicValueKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicValue =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicValueKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicValue.newBuilder()).apply { block() }._build()
object GattCharacteristicValueKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicValue.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicValue.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicValue = _builder.build()
/**
* <code>string gatt_key = 1;</code>
*/
var gattKey: kotlin.String
@JvmName("getGattKey")
get() = _builder.getGattKey()
@JvmName("setGattKey")
set(value) {
_builder.setGattKey(value)
}
/**
* <code>string gatt_key = 1;</code>
*/
fun clearGattKey() {
_builder.clearGattKey()
}
/**
* <code>string service_key = 2;</code>
*/
var serviceKey: kotlin.String
@JvmName("getServiceKey")
get() = _builder.getServiceKey()
@JvmName("setServiceKey")
set(value) {
_builder.setServiceKey(value)
}
/**
* <code>string service_key = 2;</code>
*/
fun clearServiceKey() {
_builder.clearServiceKey()
}
/**
* <code>string key = 3;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 3;</code>
*/
fun clearKey() {
_builder.clearKey()
}
/**
* <code>bytes value = 4;</code>
*/
var value: com.google.protobuf.ByteString
@JvmName("getValue")
get() = _builder.getValue()
@JvmName("setValue")
set(value) {
_builder.setValue(value)
}
/**
* <code>bytes value = 4;</code>
*/
fun clearValue() {
_builder.clearValue()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicValue.copy(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicValueKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicValue =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicValueKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,113 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattCharacteristicWriteArguments(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicWriteArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicWriteArguments =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicWriteArgumentsKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicWriteArguments.newBuilder()).apply { block() }._build()
object GattCharacteristicWriteArgumentsKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicWriteArguments.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicWriteArguments.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicWriteArguments = _builder.build()
/**
* <code>string gatt_key = 1;</code>
*/
var gattKey: kotlin.String
@JvmName("getGattKey")
get() = _builder.getGattKey()
@JvmName("setGattKey")
set(value) {
_builder.setGattKey(value)
}
/**
* <code>string gatt_key = 1;</code>
*/
fun clearGattKey() {
_builder.clearGattKey()
}
/**
* <code>string service_key = 2;</code>
*/
var serviceKey: kotlin.String
@JvmName("getServiceKey")
get() = _builder.getServiceKey()
@JvmName("setServiceKey")
set(value) {
_builder.setServiceKey(value)
}
/**
* <code>string service_key = 2;</code>
*/
fun clearServiceKey() {
_builder.clearServiceKey()
}
/**
* <code>string key = 3;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 3;</code>
*/
fun clearKey() {
_builder.clearKey()
}
/**
* <code>bytes value = 4;</code>
*/
var value: com.google.protobuf.ByteString
@JvmName("getValue")
get() = _builder.getValue()
@JvmName("setValue")
set(value) {
_builder.setValue(value)
}
/**
* <code>bytes value = 4;</code>
*/
fun clearValue() {
_builder.clearValue()
}
/**
* <code>bool withoutResponse = 5;</code>
*/
var withoutResponse: kotlin.Boolean
@JvmName("getWithoutResponse")
get() = _builder.getWithoutResponse()
@JvmName("setWithoutResponse")
set(value) {
_builder.setWithoutResponse(value)
}
/**
* <code>bool withoutResponse = 5;</code>
*/
fun clearWithoutResponse() {
_builder.clearWithoutResponse()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicWriteArguments.copy(block: dev.yanshouwang.bluetooth_low_energy.GattCharacteristicWriteArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicWriteArguments =
dev.yanshouwang.bluetooth_low_energy.GattCharacteristicWriteArgumentsKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,62 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattConnectionLost(block: dev.yanshouwang.bluetooth_low_energy.GattConnectionLostKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattConnectionLost =
dev.yanshouwang.bluetooth_low_energy.GattConnectionLostKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattConnectionLost.newBuilder()).apply { block() }._build()
object GattConnectionLostKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattConnectionLost.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattConnectionLost.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattConnectionLost = _builder.build()
/**
* <code>string key = 1;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 1;</code>
*/
fun clearKey() {
_builder.clearKey()
}
/**
* <code>string error = 2;</code>
*/
var error: kotlin.String
@JvmName("getError")
get() = _builder.getError()
@JvmName("setError")
set(value) {
_builder.setError(value)
}
/**
* <code>string error = 2;</code>
*/
fun clearError() {
_builder.clearError()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattConnectionLost.copy(block: dev.yanshouwang.bluetooth_low_energy.GattConnectionLostKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattConnectionLost =
dev.yanshouwang.bluetooth_low_energy.GattConnectionLostKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,62 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattDescriptor(block: dev.yanshouwang.bluetooth_low_energy.GattDescriptorKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor =
dev.yanshouwang.bluetooth_low_energy.GattDescriptorKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor.newBuilder()).apply { block() }._build()
object GattDescriptorKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor = _builder.build()
/**
* <code>string key = 1;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 1;</code>
*/
fun clearKey() {
_builder.clearKey()
}
/**
* <code>string uuid = 2;</code>
*/
var uuid: kotlin.String
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>string uuid = 2;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor.copy(block: dev.yanshouwang.bluetooth_low_energy.GattDescriptorKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptor =
dev.yanshouwang.bluetooth_low_energy.GattDescriptorKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,96 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattDescriptorReadArguments(block: dev.yanshouwang.bluetooth_low_energy.GattDescriptorReadArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorReadArguments =
dev.yanshouwang.bluetooth_low_energy.GattDescriptorReadArgumentsKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorReadArguments.newBuilder()).apply { block() }._build()
object GattDescriptorReadArgumentsKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorReadArguments.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorReadArguments.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorReadArguments = _builder.build()
/**
* <code>string gatt_key = 1;</code>
*/
var gattKey: kotlin.String
@JvmName("getGattKey")
get() = _builder.getGattKey()
@JvmName("setGattKey")
set(value) {
_builder.setGattKey(value)
}
/**
* <code>string gatt_key = 1;</code>
*/
fun clearGattKey() {
_builder.clearGattKey()
}
/**
* <code>string service_key = 2;</code>
*/
var serviceKey: kotlin.String
@JvmName("getServiceKey")
get() = _builder.getServiceKey()
@JvmName("setServiceKey")
set(value) {
_builder.setServiceKey(value)
}
/**
* <code>string service_key = 2;</code>
*/
fun clearServiceKey() {
_builder.clearServiceKey()
}
/**
* <code>string characteristic_key = 3;</code>
*/
var characteristicKey: kotlin.String
@JvmName("getCharacteristicKey")
get() = _builder.getCharacteristicKey()
@JvmName("setCharacteristicKey")
set(value) {
_builder.setCharacteristicKey(value)
}
/**
* <code>string characteristic_key = 3;</code>
*/
fun clearCharacteristicKey() {
_builder.clearCharacteristicKey()
}
/**
* <code>string key = 4;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 4;</code>
*/
fun clearKey() {
_builder.clearKey()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorReadArguments.copy(block: dev.yanshouwang.bluetooth_low_energy.GattDescriptorReadArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorReadArguments =
dev.yanshouwang.bluetooth_low_energy.GattDescriptorReadArgumentsKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,113 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattDescriptorWriteArguments(block: dev.yanshouwang.bluetooth_low_energy.GattDescriptorWriteArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorWriteArguments =
dev.yanshouwang.bluetooth_low_energy.GattDescriptorWriteArgumentsKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorWriteArguments.newBuilder()).apply { block() }._build()
object GattDescriptorWriteArgumentsKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorWriteArguments.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorWriteArguments.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorWriteArguments = _builder.build()
/**
* <code>string gatt_key = 1;</code>
*/
var gattKey: kotlin.String
@JvmName("getGattKey")
get() = _builder.getGattKey()
@JvmName("setGattKey")
set(value) {
_builder.setGattKey(value)
}
/**
* <code>string gatt_key = 1;</code>
*/
fun clearGattKey() {
_builder.clearGattKey()
}
/**
* <code>string service_key = 2;</code>
*/
var serviceKey: kotlin.String
@JvmName("getServiceKey")
get() = _builder.getServiceKey()
@JvmName("setServiceKey")
set(value) {
_builder.setServiceKey(value)
}
/**
* <code>string service_key = 2;</code>
*/
fun clearServiceKey() {
_builder.clearServiceKey()
}
/**
* <code>string characteristic_key = 3;</code>
*/
var characteristicKey: kotlin.String
@JvmName("getCharacteristicKey")
get() = _builder.getCharacteristicKey()
@JvmName("setCharacteristicKey")
set(value) {
_builder.setCharacteristicKey(value)
}
/**
* <code>string characteristic_key = 3;</code>
*/
fun clearCharacteristicKey() {
_builder.clearCharacteristicKey()
}
/**
* <code>string key = 4;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 4;</code>
*/
fun clearKey() {
_builder.clearKey()
}
/**
* <code>bytes value = 5;</code>
*/
var value: com.google.protobuf.ByteString
@JvmName("getValue")
get() = _builder.getValue()
@JvmName("setValue")
set(value) {
_builder.setValue(value)
}
/**
* <code>bytes value = 5;</code>
*/
fun clearValue() {
_builder.clearValue()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorWriteArguments.copy(block: dev.yanshouwang.bluetooth_low_energy.GattDescriptorWriteArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorWriteArguments =
dev.yanshouwang.bluetooth_low_energy.GattDescriptorWriteArgumentsKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,45 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattDisconnectArguments(block: dev.yanshouwang.bluetooth_low_energy.GattDisconnectArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDisconnectArguments =
dev.yanshouwang.bluetooth_low_energy.GattDisconnectArgumentsKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDisconnectArguments.newBuilder()).apply { block() }._build()
object GattDisconnectArgumentsKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDisconnectArguments.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDisconnectArguments.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDisconnectArguments = _builder.build()
/**
* <code>string key = 1;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 1;</code>
*/
fun clearKey() {
_builder.clearKey()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDisconnectArguments.copy(block: dev.yanshouwang.bluetooth_low_energy.GattDisconnectArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDisconnectArguments =
dev.yanshouwang.bluetooth_low_energy.GattDisconnectArgumentsKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,125 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun gattService(block: dev.yanshouwang.bluetooth_low_energy.GattServiceKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService =
dev.yanshouwang.bluetooth_low_energy.GattServiceKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService.newBuilder()).apply { block() }._build()
object GattServiceKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService = _builder.build()
/**
* <code>string key = 1;</code>
*/
var key: kotlin.String
@JvmName("getKey")
get() = _builder.getKey()
@JvmName("setKey")
set(value) {
_builder.setKey(value)
}
/**
* <code>string key = 1;</code>
*/
fun clearKey() {
_builder.clearKey()
}
/**
* <code>string uuid = 2;</code>
*/
var uuid: kotlin.String
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>string uuid = 2;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
class CharacteristicsProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattCharacteristic characteristics = 3;</code>
*/
val characteristics: com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic, CharacteristicsProxy>
@kotlin.jvm.JvmSynthetic
get() = com.google.protobuf.kotlin.DslList(
_builder.getCharacteristicsList()
)
/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattCharacteristic characteristics = 3;</code>
* @param value The characteristics to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addCharacteristics")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic, CharacteristicsProxy>.add(value: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic) {
_builder.addCharacteristics(value)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattCharacteristic characteristics = 3;</code>
* @param value The characteristics to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignCharacteristics")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic, CharacteristicsProxy>.plusAssign(value: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic) {
add(value)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattCharacteristic characteristics = 3;</code>
* @param values The characteristics to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllCharacteristics")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic, CharacteristicsProxy>.addAll(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic>) {
_builder.addAllCharacteristics(values)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattCharacteristic characteristics = 3;</code>
* @param values The characteristics to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllCharacteristics")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic, CharacteristicsProxy>.plusAssign(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic>) {
addAll(values)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattCharacteristic characteristics = 3;</code>
* @param index The index to set the value at.
* @param value The characteristics to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setCharacteristics")
operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic, CharacteristicsProxy>.set(index: kotlin.Int, value: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic) {
_builder.setCharacteristics(index, value)
}/**
* <code>repeated .dev.yanshouwang.bluetooth_low_energy.GattCharacteristic characteristics = 3;</code>
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearCharacteristics")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristic, CharacteristicsProxy>.clear() {
_builder.clearCharacteristics()
}}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService.copy(block: dev.yanshouwang.bluetooth_low_energy.GattServiceKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattService =
dev.yanshouwang.bluetooth_low_energy.GattServiceKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,340 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun message(block: dev.yanshouwang.bluetooth_low_energy.MessageKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Message =
dev.yanshouwang.bluetooth_low_energy.MessageKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Message.newBuilder()).apply { block() }._build()
object MessageKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Message.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Message.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Message = _builder.build()
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.MessageCategory category = 1;</code>
*/
var category: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.MessageCategory
@JvmName("getCategory")
get() = _builder.getCategory()
@JvmName("setCategory")
set(value) {
_builder.setCategory(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.MessageCategory category = 1;</code>
*/
fun clearCategory() {
_builder.clearCategory()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.BluetoothState state = 2;</code>
*/
var state: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.BluetoothState
@JvmName("getState")
get() = _builder.getState()
@JvmName("setState")
set(value) {
_builder.setState(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.BluetoothState state = 2;</code>
*/
fun clearState() {
_builder.clearState()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.BluetoothState state = 2;</code>
* @return Whether the state field is set.
*/
fun hasState(): kotlin.Boolean {
return _builder.hasState()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.StartDiscoveryArguments startDiscoveryArguments = 3;</code>
*/
var startDiscoveryArguments: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.StartDiscoveryArguments
@JvmName("getStartDiscoveryArguments")
get() = _builder.getStartDiscoveryArguments()
@JvmName("setStartDiscoveryArguments")
set(value) {
_builder.setStartDiscoveryArguments(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.StartDiscoveryArguments startDiscoveryArguments = 3;</code>
*/
fun clearStartDiscoveryArguments() {
_builder.clearStartDiscoveryArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.StartDiscoveryArguments startDiscoveryArguments = 3;</code>
* @return Whether the startDiscoveryArguments field is set.
*/
fun hasStartDiscoveryArguments(): kotlin.Boolean {
return _builder.hasStartDiscoveryArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.Discovery discovery = 4;</code>
*/
var discovery: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Discovery
@JvmName("getDiscovery")
get() = _builder.getDiscovery()
@JvmName("setDiscovery")
set(value) {
_builder.setDiscovery(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.Discovery discovery = 4;</code>
*/
fun clearDiscovery() {
_builder.clearDiscovery()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.Discovery discovery = 4;</code>
* @return Whether the discovery field is set.
*/
fun hasDiscovery(): kotlin.Boolean {
return _builder.hasDiscovery()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.ConnectArguments connectArguments = 5;</code>
*/
var connectArguments: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.ConnectArguments
@JvmName("getConnectArguments")
get() = _builder.getConnectArguments()
@JvmName("setConnectArguments")
set(value) {
_builder.setConnectArguments(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.ConnectArguments connectArguments = 5;</code>
*/
fun clearConnectArguments() {
_builder.clearConnectArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.ConnectArguments connectArguments = 5;</code>
* @return Whether the connectArguments field is set.
*/
fun hasConnectArguments(): kotlin.Boolean {
return _builder.hasConnectArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattDisconnectArguments disconnectArguments = 6;</code>
*/
var disconnectArguments: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDisconnectArguments
@JvmName("getDisconnectArguments")
get() = _builder.getDisconnectArguments()
@JvmName("setDisconnectArguments")
set(value) {
_builder.setDisconnectArguments(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattDisconnectArguments disconnectArguments = 6;</code>
*/
fun clearDisconnectArguments() {
_builder.clearDisconnectArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattDisconnectArguments disconnectArguments = 6;</code>
* @return Whether the disconnectArguments field is set.
*/
fun hasDisconnectArguments(): kotlin.Boolean {
return _builder.hasDisconnectArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattConnectionLost connectionLost = 7;</code>
*/
var connectionLost: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattConnectionLost
@JvmName("getConnectionLost")
get() = _builder.getConnectionLost()
@JvmName("setConnectionLost")
set(value) {
_builder.setConnectionLost(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattConnectionLost connectionLost = 7;</code>
*/
fun clearConnectionLost() {
_builder.clearConnectionLost()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattConnectionLost connectionLost = 7;</code>
* @return Whether the connectionLost field is set.
*/
fun hasConnectionLost(): kotlin.Boolean {
return _builder.hasConnectionLost()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicReadArguments characteristicReadArguments = 8;</code>
*/
var characteristicReadArguments: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicReadArguments
@JvmName("getCharacteristicReadArguments")
get() = _builder.getCharacteristicReadArguments()
@JvmName("setCharacteristicReadArguments")
set(value) {
_builder.setCharacteristicReadArguments(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicReadArguments characteristicReadArguments = 8;</code>
*/
fun clearCharacteristicReadArguments() {
_builder.clearCharacteristicReadArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicReadArguments characteristicReadArguments = 8;</code>
* @return Whether the characteristicReadArguments field is set.
*/
fun hasCharacteristicReadArguments(): kotlin.Boolean {
return _builder.hasCharacteristicReadArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicWriteArguments characteristicWriteArguments = 9;</code>
*/
var characteristicWriteArguments: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicWriteArguments
@JvmName("getCharacteristicWriteArguments")
get() = _builder.getCharacteristicWriteArguments()
@JvmName("setCharacteristicWriteArguments")
set(value) {
_builder.setCharacteristicWriteArguments(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicWriteArguments characteristicWriteArguments = 9;</code>
*/
fun clearCharacteristicWriteArguments() {
_builder.clearCharacteristicWriteArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicWriteArguments characteristicWriteArguments = 9;</code>
* @return Whether the characteristicWriteArguments field is set.
*/
fun hasCharacteristicWriteArguments(): kotlin.Boolean {
return _builder.hasCharacteristicWriteArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicNotifyArguments characteristicNotifyArguments = 10;</code>
*/
var characteristicNotifyArguments: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicNotifyArguments
@JvmName("getCharacteristicNotifyArguments")
get() = _builder.getCharacteristicNotifyArguments()
@JvmName("setCharacteristicNotifyArguments")
set(value) {
_builder.setCharacteristicNotifyArguments(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicNotifyArguments characteristicNotifyArguments = 10;</code>
*/
fun clearCharacteristicNotifyArguments() {
_builder.clearCharacteristicNotifyArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicNotifyArguments characteristicNotifyArguments = 10;</code>
* @return Whether the characteristicNotifyArguments field is set.
*/
fun hasCharacteristicNotifyArguments(): kotlin.Boolean {
return _builder.hasCharacteristicNotifyArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicValue characteristicValue = 11;</code>
*/
var characteristicValue: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattCharacteristicValue
@JvmName("getCharacteristicValue")
get() = _builder.getCharacteristicValue()
@JvmName("setCharacteristicValue")
set(value) {
_builder.setCharacteristicValue(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicValue characteristicValue = 11;</code>
*/
fun clearCharacteristicValue() {
_builder.clearCharacteristicValue()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattCharacteristicValue characteristicValue = 11;</code>
* @return Whether the characteristicValue field is set.
*/
fun hasCharacteristicValue(): kotlin.Boolean {
return _builder.hasCharacteristicValue()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattDescriptorReadArguments descriptorReadArguments = 12;</code>
*/
var descriptorReadArguments: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorReadArguments
@JvmName("getDescriptorReadArguments")
get() = _builder.getDescriptorReadArguments()
@JvmName("setDescriptorReadArguments")
set(value) {
_builder.setDescriptorReadArguments(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattDescriptorReadArguments descriptorReadArguments = 12;</code>
*/
fun clearDescriptorReadArguments() {
_builder.clearDescriptorReadArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattDescriptorReadArguments descriptorReadArguments = 12;</code>
* @return Whether the descriptorReadArguments field is set.
*/
fun hasDescriptorReadArguments(): kotlin.Boolean {
return _builder.hasDescriptorReadArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattDescriptorWriteArguments descriptorWriteArguments = 13;</code>
*/
var descriptorWriteArguments: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.GattDescriptorWriteArguments
@JvmName("getDescriptorWriteArguments")
get() = _builder.getDescriptorWriteArguments()
@JvmName("setDescriptorWriteArguments")
set(value) {
_builder.setDescriptorWriteArguments(value)
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattDescriptorWriteArguments descriptorWriteArguments = 13;</code>
*/
fun clearDescriptorWriteArguments() {
_builder.clearDescriptorWriteArguments()
}
/**
* <code>.dev.yanshouwang.bluetooth_low_energy.GattDescriptorWriteArguments descriptorWriteArguments = 13;</code>
* @return Whether the descriptorWriteArguments field is set.
*/
fun hasDescriptorWriteArguments(): kotlin.Boolean {
return _builder.hasDescriptorWriteArguments()
}
val valueCase: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Message.ValueCase
@JvmName("getValueCase")
get() = _builder.getValueCase()
fun clearValue() {
_builder.clearValue()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Message.copy(block: dev.yanshouwang.bluetooth_low_energy.MessageKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.Message =
dev.yanshouwang.bluetooth_low_energy.MessageKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -0,0 +1,163 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.*
import android.bluetooth.BluetoothGattCallback
import dev.yanshouwang.bluetooth_low_energy.pigeon.Api
import dev.yanshouwang.bluetooth_low_energy.proto.bluetoothLowEnergyException
import dev.yanshouwang.bluetooth_low_energy.proto.gattService
import dev.yanshouwang.bluetooth_low_energy.proto.peripheral
import dev.yanshouwang.bluetooth_low_energy.proto.uUID
object MyBluetoothGattCallback : BluetoothGattCallback() {
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
super.onConnectionStateChange(gatt, status, newState)
if (status == BluetoothGatt.GATT_SUCCESS) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
// Connect succeed.
val requested = gatt.requestMtu(512)
if (!requested) {
gatt.disconnect()
}
} else {
// Maybe disconnect succeed, connection failed or connection lost.
gatt.close()
val connectResult = items.remove("${gatt.hashCode()}/${KEY_CONNECT_RESULT}") as Api.Result<ByteArray>?
if (connectResult == null) {
val disconnectResult = items.remove("${gatt.hashCode()}/${KEY_DISCONNECT_RESULT}") as Api.Result<Void>?
if (disconnectResult == null) {
val id = identifiers[gatt] as Long
val errorBuffer = bluetoothLowEnergyException {
this.message = "GATT connection lost."
}.toByteArray()
mainExecutor.execute {
peripheralFlutterApi.notifyConnectionLost(id, errorBuffer) {}
}
} else {
disconnectResult.success(null)
}
} else {
val errorMessage = "GATT connection lost."
val error = BluetoothLowEnergyException(errorMessage)
connectResult.error(error)
}
}
} else {
// Maybe connect failed, disconnect failed or connection lost.
gatt.close()
val connectResult = items.remove("${gatt.hashCode()}/${KEY_CONNECT_RESULT}") as Api.Result<ByteArray>?
if (connectResult == null) {
val disconnectResult = items.remove("${gatt.hashCode()}/${KEY_DISCONNECT_RESULT}") as Api.Result<Void>?
if (disconnectResult == null) {
val id = identifiers[gatt] as Long
val errorBuffer = bluetoothLowEnergyException {
this.message = "GATT error with status: $status"
}.toByteArray()
mainExecutor.execute {
peripheralFlutterApi.notifyConnectionLost(id, errorBuffer) {}
}
} else {
val error = BluetoothLowEnergyException("GATT error with status: $status")
disconnectResult.error(error)
}
} else {
val error = BluetoothLowEnergyException("GATT error with status: $status")
connectResult.error(error)
}
}
}
override fun onMtuChanged(gatt: BluetoothGatt, mtu: Int, status: Int) {
super.onMtuChanged(gatt, mtu, status)
when (status) {
BluetoothGatt.GATT_SUCCESS -> {
val connectResult = items.remove("${gatt.hashCode()}/${KEY_CONNECT_RESULT}") as Api.Result<ByteArray>
val gattId = gatt.hashCode().toLong()
instances[gattId] = gatt
val peripheralValue = peripheral {
this.id = gattId
this.maximumWriteLength = mtu - 3
}.toByteArray()
connectResult.success(peripheralValue)
}
else -> {
gatt.disconnect()
}
}
}
override fun onServicesDiscovered(gatt: BluetoothGatt, status: Int) {
super.onServicesDiscovered(gatt, status)
val result = items.remove("${gatt.hashCode()}/${KEY_DISCOVER_SERVICES_RESULT}") as Api.Result<MutableList<ByteArray>>
if (status == BluetoothGatt.GATT_SUCCESS) {
val serviceValues = mutableListOf<ByteArray>()
for (service in gatt.services) {
val serviceId = service.hashCode().toLong()
instances[serviceId] = listOf(gatt, service)
val serviceValue = gattService {
this.id = serviceId
this.uuid = uUID {
this.value = service.uuid.toString()
}
}.toByteArray()
serviceValues.add(serviceValue)
}
result.success(serviceValues)
} else {
val error = BluetoothLowEnergyException("GATT discover services failed with status: $status")
result.error(error)
}
}
override fun onCharacteristicRead(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) {
super.onCharacteristicRead(gatt, characteristic, status)
val result = items.remove("${characteristic.hashCode()}/${KEY_READ_RESULT}") as Api.Result<ByteArray>
if (status == BluetoothGatt.GATT_SUCCESS) {
result.success(characteristic.value)
} else {
val error = BluetoothLowEnergyException("GATT read characteristic failed with status: $status.")
result.error(error)
}
}
override fun onCharacteristicWrite(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) {
super.onCharacteristicWrite(gatt, characteristic, status)
val result = items.remove("${characteristic.hashCode()}/${KEY_WRITE_RESULT}") as Api.Result<Void>
if (status == BluetoothGatt.GATT_SUCCESS) {
result.success(null)
} else {
val error = BluetoothLowEnergyException("GATT write characteristic failed with status: $status.")
result.error(error)
}
}
override fun onCharacteristicChanged(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) {
super.onCharacteristicChanged(gatt, characteristic)
val id = identifiers[characteristic] as Long
val value = characteristic.value
mainExecutor.execute {
characteristicFlutterApi.notifyValue(id, value) {}
}
}
override fun onDescriptorRead(gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int) {
super.onDescriptorRead(gatt, descriptor, status)
val result = items.remove("${descriptor.hashCode()}/${KEY_READ_RESULT}") as Api.Result<ByteArray>
if (status == BluetoothGatt.GATT_SUCCESS) {
result.success(descriptor.value)
} else {
val error = BluetoothLowEnergyException("GATT read descriptor failed with status: $status.")
result.error(error)
}
}
override fun onDescriptorWrite(gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int) {
super.onDescriptorWrite(gatt, descriptor, status)
val result = items.remove("${descriptor.hashCode()}/${KEY_WRITE_RESULT}") as Api.Result<Void>
if (status == BluetoothGatt.GATT_SUCCESS) {
result.success(null)
} else {
val error = BluetoothLowEnergyException("GATT write descriptor failed with status: $status.")
result.error(error)
}
}
}

View File

@ -0,0 +1,19 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothAdapter
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
object MyBroadcastReceiver : BroadcastReceiver() {
private const val STATE_UNKNOWN = -1
override fun onReceive(context: Context, intent: Intent) {
val previousState =
intent.getIntExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE, STATE_UNKNOWN).bluetoothState
val state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, STATE_UNKNOWN).bluetoothState
if (state == previousState) return
val stateNumber = state.number.toLong()
centralFlutterApi.notifyState(stateNumber) {}
}
}

View File

@ -0,0 +1,87 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
import android.bluetooth.le.ScanFilter
import android.bluetooth.le.ScanSettings
import android.content.IntentFilter
import android.content.pm.PackageManager
import android.os.Build
import android.os.ParcelUuid
import androidx.core.app.ActivityCompat
import dev.yanshouwang.bluetooth_low_energy.pigeon.Api
import dev.yanshouwang.bluetooth_low_energy.proto.BluetoothState
import dev.yanshouwang.bluetooth_low_energy.proto.UUID
object MyCentralManagerHostApi : Api.CentralManagerHostApi {
override fun authorize(result: Api.Result<Boolean>) {
val permissions = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_SCAN, android.Manifest.permission.BLUETOOTH_CONNECT)
} else {
arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION)
}
val authorized = permissions.all { permission ->
ActivityCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_GRANTED
}
if (authorized) {
result.success(true)
} else {
ActivityCompat.requestPermissions(activity, permissions, REQUEST_CODE)
items[KEY_AUTHORIZE_RESULT] = result
}
}
override fun getState(): Long {
val state = if (bluetoothAvailable) {
bluetoothAdapter.state.bluetoothState
} else {
BluetoothState.BLUETOOTH_STATE_UNSUPPORTED
}
return state.number.toLong()
}
override fun addStateObserver() {
val filter = IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED)
activity.registerReceiver(MyBroadcastReceiver, filter)
}
override fun removeStateObserver() {
activity.unregisterReceiver(MyBroadcastReceiver)
}
override fun startScan(uuidBuffers: MutableList<ByteArray>?, result: Api.Result<Void>) {
val filters = uuidBuffers?.map { buffer ->
val uuid = UUID.parseFrom(buffer).value
val serviceUUID = ParcelUuid.fromString(uuid)
ScanFilter.Builder().setServiceUuid(serviceUUID).build()
}
val settings = ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build()
bluetoothAdapter.bluetoothLeScanner.startScan(filters, settings, MyScanCallback)
// Use main handler.post to delay until ScanCallback.onScanFailed executed.
mainHandler.post {
val error = items.remove(KEY_START_SCAN_ERROR) as Throwable?
if (error == null) {
result.success(null)
} else {
result.error(error)
}
}
}
override fun stopScan() {
bluetoothAdapter.bluetoothLeScanner.stopScan(MyScanCallback)
}
override fun connect(uuidBuffer: ByteArray, result: Api.Result<ByteArray>) {
val address = UUID.parseFrom(uuidBuffer).value.address
val device = bluetoothAdapter.getRemoteDevice(address)
val autoConnect = false
val gatt = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val transport = BluetoothDevice.TRANSPORT_LE
device.connectGatt(activity, autoConnect, MyBluetoothGattCallback, transport)
} else {
device.connectGatt(activity, autoConnect, MyBluetoothGattCallback)
}
items["${gatt.hashCode()}/${KEY_CONNECT_RESULT}"] = result
}
}

View File

@ -0,0 +1,103 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattCharacteristic
import android.bluetooth.BluetoothGattDescriptor
import dev.yanshouwang.bluetooth_low_energy.pigeon.Api
import dev.yanshouwang.bluetooth_low_energy.proto.gattDescriptor
import dev.yanshouwang.bluetooth_low_energy.proto.uUID
import java.util.UUID
object MyGattCharacteristicHostApi : Api.GattCharacteristicHostApi {
private const val CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb"
override fun allocate(id: Long, instanceId: Long) {
val list = instances.remove(instanceId) as List<Any>
val characteristic = list[1]
instances[id] = list
identifiers[characteristic] = id
}
override fun free(id: Long) {
val list = instances.remove(id) as List<Any>
val characteristic = list[1]
identifiers.remove(characteristic)
}
override fun discoverDescriptors(id: Long, result: Api.Result<MutableList<ByteArray>>) {
val list = instances[id] as List<Any>
val gatt = list[0] as BluetoothGatt
val characteristic = list[1] as BluetoothGattCharacteristic
val descriptorValues = mutableListOf<ByteArray>()
for (descriptor in characteristic.descriptors) {
val descriptorId = descriptor.hashCode().toLong()
instances[descriptorId] = listOf(gatt, descriptor)
val descriptorValue = gattDescriptor {
this.id = descriptorId
this.uuid = uUID {
this.value = descriptor.uuid.toString()
}
}.toByteArray()
descriptorValues.add(descriptorValue)
}
result.success(descriptorValues)
}
override fun read(id: Long, result: Api.Result<ByteArray>) {
val list = instances[id] as List<Any>
val gatt = list[0] as BluetoothGatt
val characteristic = list[1] as BluetoothGattCharacteristic
val succeed = gatt.readCharacteristic(characteristic)
if (succeed) {
items["${characteristic.hashCode()}/$KEY_READ_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT read characteristic failed.")
result.error(error)
}
}
override fun write(id: Long, value: ByteArray, withoutResponse: Boolean, result: Api.Result<Void>) {
val list = instances[id] as List<Any>
val gatt = list[0] as BluetoothGatt
val characteristic = list[1] as BluetoothGattCharacteristic
characteristic.writeType = if (withoutResponse) {
BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE
} else {
BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT
}
characteristic.value = value
val succeed = gatt.writeCharacteristic(characteristic)
if (succeed) {
items["${characteristic.hashCode()}/$KEY_WRITE_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT write characteristic failed.")
result.error(error)
}
}
override fun setNotify(id: Long, value: Boolean, result: Api.Result<Void>) {
val list = instances[id] as List<Any>
val gatt = list[0] as BluetoothGatt
val characteristic = list[1] as BluetoothGattCharacteristic
val setNotificationSucceed = gatt.setCharacteristicNotification(characteristic, value)
if (setNotificationSucceed) {
val uuid = UUID.fromString(CLIENT_CHARACTERISTIC_CONFIG)
val descriptor = characteristic.getDescriptor(uuid)
descriptor.value = if (value) {
BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
} else {
BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE
}
val writeSucceed = gatt.writeDescriptor(descriptor)
if (writeSucceed) {
items["${descriptor.hashCode()}/${KEY_WRITE_RESULT}"] = result
} else {
val error = BluetoothLowEnergyException("GATT write <client characteristic config> descriptor failed.")
result.error(error)
}
} else {
val error = BluetoothLowEnergyException("GATT set characteristic notification failed.")
result.error(error)
}
}
}

View File

@ -0,0 +1,47 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattDescriptor
import dev.yanshouwang.bluetooth_low_energy.pigeon.Api
object MyGattDescriptorHostApi : Api.GattDescriptorHostApi {
override fun allocate(id: Long, instanceId: Long) {
val list = instances.remove(instanceId) as List<Any>
val descriptor = list[1]
instances[id] = list
identifiers[descriptor] = id
}
override fun free(id: Long) {
val list = instances.remove(id) as List<Any>
val descriptor = list[1]
identifiers.remove(descriptor)
}
override fun read(id: Long, result: Api.Result<ByteArray>) {
val list = instances[id] as List<Any>
val gatt = list[0] as BluetoothGatt
val descriptor = list[1] as BluetoothGattDescriptor
val succeed = gatt.readDescriptor(descriptor)
if (succeed) {
items["${descriptor.hashCode()}/$KEY_READ_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT read descriptor failed.")
result.error(error)
}
}
override fun write(id: Long, value: ByteArray, result: Api.Result<Void>) {
val list = instances[id] as List<Any>
val gatt = list[0] as BluetoothGatt
val descriptor = list[1] as BluetoothGattDescriptor
descriptor.value = value
val succeed = gatt.writeDescriptor(descriptor)
if (succeed) {
items["${descriptor.hashCode()}/$KEY_WRITE_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT write descriptor failed.")
result.error(error)
}
}
}

View File

@ -0,0 +1,47 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattCharacteristic
import android.bluetooth.BluetoothGattService
import dev.yanshouwang.bluetooth_low_energy.pigeon.Api
import dev.yanshouwang.bluetooth_low_energy.proto.gattCharacteristic
import dev.yanshouwang.bluetooth_low_energy.proto.uUID
object MyGattServiceHostApi : Api.GattServiceHostApi {
override fun allocate(id: Long, instanceId: Long) {
val list = instances.remove(instanceId) as List<Any>
val service = list[1]
instances[id] = list
identifiers[service] = id
}
override fun free(id: Long) {
val list = instances.remove(id) as List<Any>
val service = list[1]
identifiers.remove(service)
}
override fun discoverCharacteristics(id: Long, result: Api.Result<MutableList<ByteArray>>) {
val list = instances[id] as List<Any>
val gatt = list[0] as BluetoothGatt
val service = list[1] as BluetoothGattService
val characteristicValues = mutableListOf<ByteArray>()
for (characteristic in service.characteristics) {
val characteristicId = characteristic.hashCode().toLong()
instances[characteristicId] = listOf(gatt, characteristic)
val characteristicValue = gattCharacteristic {
this.id = characteristicId
this.uuid = uUID {
this.value = characteristic.uuid.toString()
}
this.canRead = characteristic.properties and BluetoothGattCharacteristic.PROPERTY_READ != 0
this.canWrite = characteristic.properties and BluetoothGattCharacteristic.PROPERTY_WRITE != 0
this.canWriteWithoutResponse =
characteristic.properties and BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE != 0
this.canNotify = characteristic.properties and BluetoothGattCharacteristic.PROPERTY_NOTIFY != 0
}.toByteArray()
characteristicValues.add(characteristicValue)
}
result.success(characteristicValues)
}
}

View File

@ -0,0 +1,34 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGatt
import dev.yanshouwang.bluetooth_low_energy.pigeon.Api
object MyPeripheralHostApi : Api.PeripheralHostApi {
override fun allocate(id: Long, instanceId: Long) {
val gatt = instances.remove(instanceId) as BluetoothGatt
instances[id] = gatt
identifiers[gatt] = id
}
override fun free(id: Long) {
val gatt = instances.remove(id) as BluetoothGatt
identifiers.remove(gatt)
}
override fun disconnect(id: Long, result: Api.Result<Void>) {
val gatt = instances[id] as BluetoothGatt
gatt.disconnect()
items["${gatt.hashCode()}/$KEY_DISCONNECT_RESULT"] = result
}
override fun discoverServices(id: Long, result: Api.Result<MutableList<ByteArray>>) {
val gatt = instances[id] as BluetoothGatt
val started = gatt.discoverServices()
if (started) {
items["${gatt.hashCode()}/$KEY_DISCOVER_SERVICES_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("Start discover services failed.")
result.error(error)
}
}
}

View File

@ -0,0 +1,19 @@
package dev.yanshouwang.bluetooth_low_energy
import android.content.pm.PackageManager
import dev.yanshouwang.bluetooth_low_energy.pigeon.Api
import io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener
object MyRequestPermissionsResultListener : RequestPermissionsResultListener {
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray): Boolean {
return when (requestCode) {
REQUEST_CODE -> {
val result = items.remove(KEY_AUTHORIZE_RESULT) as Api.Result<Boolean>
val authorized = grantResults.all { grantResult -> grantResult == PackageManager.PERMISSION_GRANTED }
result.success(authorized)
true
}
else -> false
}
}
}

View File

@ -0,0 +1,81 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.le.ScanCallback
import android.bluetooth.le.ScanResult
import android.bluetooth.le.ScanSettings
import android.os.Build
import com.google.protobuf.ByteString
import dev.yanshouwang.bluetooth_low_energy.proto.advertisement
import dev.yanshouwang.bluetooth_low_energy.proto.serviceData
import dev.yanshouwang.bluetooth_low_energy.proto.uUID
object MyScanCallback : ScanCallback() {
override fun onScanFailed(errorCode: Int) {
super.onScanFailed(errorCode)
val error = BluetoothLowEnergyException("Start scan failed with code: $errorCode")
items[KEY_START_SCAN_ERROR] = error
}
override fun onScanResult(callbackType: Int, result: ScanResult) {
super.onScanResult(callbackType, result)
val advertisementValue = advertisement {
this.uuid = uUID {
this.value = result.device.uuidString
}
this.rssi = result.rssi
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
this.connectable = result.isConnectable
}
val scanRecord = result.scanRecord
if (scanRecord == null) {
this.data = ByteString.EMPTY
} else {
this.data = ByteString.copyFrom(scanRecord.bytes)
val deviceName = scanRecord.deviceName
if (deviceName != null) {
this.localName = deviceName
}
val manufacturerSpecificData = scanRecord.rawManufacturerSpecificData
if (manufacturerSpecificData != null) {
this.manufacturerSpecificData = ByteString.copyFrom(manufacturerSpecificData)
}
val serviceDatas = scanRecord.serviceData.map { entry ->
serviceData {
this.uuid = uUID {
this.value = entry.key.toString()
}
this.data = ByteString.copyFrom(entry.value)
}
}
this.serviceDatas.addAll(serviceDatas)
val serviceUUIDs = scanRecord.serviceUuids
if (serviceUUIDs != null) {
val uuids = serviceUUIDs.map { uuid ->
uUID {
this.value = uuid.toString()
}
}
this.serviceUuids.addAll(uuids)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val uuids = scanRecord.serviceSolicitationUuids.map { uuid ->
uUID {
this.value = uuid.toString()
}
}
this.solicitedServiceUuids.addAll(uuids)
}
this.txPowerLevel = scanRecord.txPowerLevel
}
}.toByteArray()
centralFlutterApi.notifyAdvertisement(advertisementValue) {}
}
override fun onBatchScanResults(results: MutableList<ScanResult>) {
super.onBatchScanResults(results)
for (result in results) {
onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES, result)
}
}
}

View File

@ -1,5 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGatt
class NativeGATT(value: BluetoothGatt, val services: Map<String, NativeGattService>) : NativeValue<BluetoothGatt>(value)

View File

@ -1,5 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGattCharacteristic
class NativeGattCharacteristic(value: BluetoothGattCharacteristic, val descriptors: Map<String, NativeGattDescriptor>) : NativeValue<BluetoothGattCharacteristic>(value)

View File

@ -1,5 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGattDescriptor
class NativeGattDescriptor(value: BluetoothGattDescriptor) : NativeValue<BluetoothGattDescriptor>(value)

View File

@ -1,5 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGattService
class NativeGattService(value: BluetoothGattService, val characteristics: Map<String, NativeGattCharacteristic>) : NativeValue<BluetoothGattService>(value)

View File

@ -1,7 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import java.util.*
open class NativeValue<T>(val value: T) {
public val key = UUID.randomUUID().toString()
}

View File

@ -1,96 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
package dev.yanshouwang.bluetooth_low_energy;
@kotlin.jvm.JvmSynthetic
inline fun startDiscoveryArguments(block: dev.yanshouwang.bluetooth_low_energy.StartDiscoveryArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.StartDiscoveryArguments =
dev.yanshouwang.bluetooth_low_energy.StartDiscoveryArgumentsKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.StartDiscoveryArguments.newBuilder()).apply { block() }._build()
object StartDiscoveryArgumentsKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
@kotlin.jvm.JvmField private val _builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.StartDiscoveryArguments.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.StartDiscoveryArguments.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.StartDiscoveryArguments = _builder.build()
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
class ServicesProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* <code>repeated string services = 1;</code>
* @return A list containing the services.
*/
val services: com.google.protobuf.kotlin.DslList<kotlin.String, ServicesProxy>
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
get() = com.google.protobuf.kotlin.DslList(
_builder.getServicesList()
)
/**
* <code>repeated string services = 1;</code>
* @param value The services to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addServices")
fun com.google.protobuf.kotlin.DslList<kotlin.String, ServicesProxy>.add(value: kotlin.String) {
_builder.addServices(value)
}
/**
* <code>repeated string services = 1;</code>
* @param value The services to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignServices")
operator fun com.google.protobuf.kotlin.DslList<kotlin.String, ServicesProxy>.plusAssign(value: kotlin.String) {
_builder.addServices(value)
}
/**
* <code>repeated string services = 1;</code>
* @param values The services to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllServices")
fun com.google.protobuf.kotlin.DslList<kotlin.String, ServicesProxy>.addAll(values: kotlin.collections.Iterable<kotlin.String>) {
_builder.addAllServices(values)
}
/**
* <code>repeated string services = 1;</code>
* @param values The services to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllServices")
operator fun com.google.protobuf.kotlin.DslList<kotlin.String, ServicesProxy>.plusAssign(values: kotlin.collections.Iterable<kotlin.String>) {
_builder.addAllServices(values)
}
/**
* <code>repeated string services = 1;</code>
* @param index The index to set the value at.
* @param value The services to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setServices")
operator fun com.google.protobuf.kotlin.DslList<kotlin.String, ServicesProxy>.set(index: kotlin.Int, value: kotlin.String) {
_builder.setServices(index, value)
}/**
* <code>repeated string services = 1;</code>
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearServices")
fun com.google.protobuf.kotlin.DslList<kotlin.String, ServicesProxy>.clear() {
_builder.clearServices()
}}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.StartDiscoveryArguments.copy(block: dev.yanshouwang.bluetooth_low_energy.StartDiscoveryArgumentsKt.Dsl.() -> Unit): dev.yanshouwang.bluetooth_low_energy.MessageOuterClass.StartDiscoveryArguments =
dev.yanshouwang.bluetooth_low_energy.StartDiscoveryArgumentsKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -0,0 +1,395 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
@kotlin.jvm.JvmName("-initializeadvertisement")
inline fun advertisement(block: dev.yanshouwang.bluetooth_low_energy.proto.AdvertisementKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.Advertisement =
dev.yanshouwang.bluetooth_low_energy.proto.AdvertisementKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.proto.Advertisement.newBuilder()).apply { block() }._build()
object AdvertisementKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
private val _builder: dev.yanshouwang.bluetooth_low_energy.proto.Advertisement.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.proto.Advertisement.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.proto.Advertisement = _builder.build()
/**
* <code>.proto.UUID uuid = 1;</code>
*/
var uuid: dev.yanshouwang.bluetooth_low_energy.proto.UUID
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
/**
* <code>.proto.UUID uuid = 1;</code>
* @return Whether the uuid field is set.
*/
fun hasUuid(): kotlin.Boolean {
return _builder.hasUuid()
}
/**
* <code>int32 rssi = 2;</code>
*/
var rssi: kotlin.Int
@JvmName("getRssi")
get() = _builder.getRssi()
@JvmName("setRssi")
set(value) {
_builder.setRssi(value)
}
/**
* <code>int32 rssi = 2;</code>
*/
fun clearRssi() {
_builder.clearRssi()
}
/**
* <code>optional bool connectable = 3;</code>
*/
var connectable: kotlin.Boolean
@JvmName("getConnectable")
get() = _builder.getConnectable()
@JvmName("setConnectable")
set(value) {
_builder.setConnectable(value)
}
/**
* <code>optional bool connectable = 3;</code>
*/
fun clearConnectable() {
_builder.clearConnectable()
}
/**
* <code>optional bool connectable = 3;</code>
* @return Whether the connectable field is set.
*/
fun hasConnectable(): kotlin.Boolean {
return _builder.hasConnectable()
}
/**
* <code>bytes data = 4;</code>
*/
var data: com.google.protobuf.ByteString
@JvmName("getData")
get() = _builder.getData()
@JvmName("setData")
set(value) {
_builder.setData(value)
}
/**
* <code>bytes data = 4;</code>
*/
fun clearData() {
_builder.clearData()
}
/**
* <code>optional string local_name = 5;</code>
*/
var localName: kotlin.String
@JvmName("getLocalName")
get() = _builder.getLocalName()
@JvmName("setLocalName")
set(value) {
_builder.setLocalName(value)
}
/**
* <code>optional string local_name = 5;</code>
*/
fun clearLocalName() {
_builder.clearLocalName()
}
/**
* <code>optional string local_name = 5;</code>
* @return Whether the localName field is set.
*/
fun hasLocalName(): kotlin.Boolean {
return _builder.hasLocalName()
}
/**
* <code>bytes manufacturer_specific_data = 6;</code>
*/
var manufacturerSpecificData: com.google.protobuf.ByteString
@JvmName("getManufacturerSpecificData")
get() = _builder.getManufacturerSpecificData()
@JvmName("setManufacturerSpecificData")
set(value) {
_builder.setManufacturerSpecificData(value)
}
/**
* <code>bytes manufacturer_specific_data = 6;</code>
*/
fun clearManufacturerSpecificData() {
_builder.clearManufacturerSpecificData()
}
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
class ServiceDatasProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
*/
val serviceDatas: com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData, ServiceDatasProxy>
@kotlin.jvm.JvmSynthetic
get() = com.google.protobuf.kotlin.DslList(
_builder.getServiceDatasList()
)
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
* @param value The serviceDatas to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addServiceDatas")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData, ServiceDatasProxy>.add(value: dev.yanshouwang.bluetooth_low_energy.proto.ServiceData) {
_builder.addServiceDatas(value)
}
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
* @param value The serviceDatas to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignServiceDatas")
@Suppress("NOTHING_TO_INLINE")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData, ServiceDatasProxy>.plusAssign(value: dev.yanshouwang.bluetooth_low_energy.proto.ServiceData) {
add(value)
}
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
* @param values The serviceDatas to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllServiceDatas")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData, ServiceDatasProxy>.addAll(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData>) {
_builder.addAllServiceDatas(values)
}
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
* @param values The serviceDatas to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllServiceDatas")
@Suppress("NOTHING_TO_INLINE")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData, ServiceDatasProxy>.plusAssign(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData>) {
addAll(values)
}
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
* @param index The index to set the value at.
* @param value The serviceDatas to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setServiceDatas")
operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData, ServiceDatasProxy>.set(index: kotlin.Int, value: dev.yanshouwang.bluetooth_low_energy.proto.ServiceData) {
_builder.setServiceDatas(index, value)
}
/**
* <code>repeated .proto.ServiceData service_datas = 7;</code>
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearServiceDatas")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.ServiceData, ServiceDatasProxy>.clear() {
_builder.clearServiceDatas()
}
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
class ServiceUuidsProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
*/
val serviceUuids: com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, ServiceUuidsProxy>
@kotlin.jvm.JvmSynthetic
get() = com.google.protobuf.kotlin.DslList(
_builder.getServiceUuidsList()
)
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
* @param value The serviceUuids to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addServiceUuids")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, ServiceUuidsProxy>.add(value: dev.yanshouwang.bluetooth_low_energy.proto.UUID) {
_builder.addServiceUuids(value)
}
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
* @param value The serviceUuids to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignServiceUuids")
@Suppress("NOTHING_TO_INLINE")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, ServiceUuidsProxy>.plusAssign(value: dev.yanshouwang.bluetooth_low_energy.proto.UUID) {
add(value)
}
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
* @param values The serviceUuids to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllServiceUuids")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, ServiceUuidsProxy>.addAll(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.proto.UUID>) {
_builder.addAllServiceUuids(values)
}
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
* @param values The serviceUuids to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllServiceUuids")
@Suppress("NOTHING_TO_INLINE")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, ServiceUuidsProxy>.plusAssign(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.proto.UUID>) {
addAll(values)
}
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
* @param index The index to set the value at.
* @param value The serviceUuids to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setServiceUuids")
operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, ServiceUuidsProxy>.set(index: kotlin.Int, value: dev.yanshouwang.bluetooth_low_energy.proto.UUID) {
_builder.setServiceUuids(index, value)
}
/**
* <code>repeated .proto.UUID service_uuids = 8;</code>
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearServiceUuids")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, ServiceUuidsProxy>.clear() {
_builder.clearServiceUuids()
}
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
class SolicitedServiceUuidsProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
*/
val solicitedServiceUuids: com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, SolicitedServiceUuidsProxy>
@kotlin.jvm.JvmSynthetic
get() = com.google.protobuf.kotlin.DslList(
_builder.getSolicitedServiceUuidsList()
)
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
* @param value The solicitedServiceUuids to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addSolicitedServiceUuids")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, SolicitedServiceUuidsProxy>.add(value: dev.yanshouwang.bluetooth_low_energy.proto.UUID) {
_builder.addSolicitedServiceUuids(value)
}
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
* @param value The solicitedServiceUuids to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignSolicitedServiceUuids")
@Suppress("NOTHING_TO_INLINE")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, SolicitedServiceUuidsProxy>.plusAssign(value: dev.yanshouwang.bluetooth_low_energy.proto.UUID) {
add(value)
}
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
* @param values The solicitedServiceUuids to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllSolicitedServiceUuids")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, SolicitedServiceUuidsProxy>.addAll(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.proto.UUID>) {
_builder.addAllSolicitedServiceUuids(values)
}
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
* @param values The solicitedServiceUuids to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllSolicitedServiceUuids")
@Suppress("NOTHING_TO_INLINE")
inline operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, SolicitedServiceUuidsProxy>.plusAssign(values: kotlin.collections.Iterable<dev.yanshouwang.bluetooth_low_energy.proto.UUID>) {
addAll(values)
}
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
* @param index The index to set the value at.
* @param value The solicitedServiceUuids to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setSolicitedServiceUuids")
operator fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, SolicitedServiceUuidsProxy>.set(index: kotlin.Int, value: dev.yanshouwang.bluetooth_low_energy.proto.UUID) {
_builder.setSolicitedServiceUuids(index, value)
}
/**
* <code>repeated .proto.UUID solicited_service_uuids = 9;</code>
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearSolicitedServiceUuids")
fun com.google.protobuf.kotlin.DslList<dev.yanshouwang.bluetooth_low_energy.proto.UUID, SolicitedServiceUuidsProxy>.clear() {
_builder.clearSolicitedServiceUuids()
}
/**
* <code>optional int32 tx_power_level = 10;</code>
*/
var txPowerLevel: kotlin.Int
@JvmName("getTxPowerLevel")
get() = _builder.getTxPowerLevel()
@JvmName("setTxPowerLevel")
set(value) {
_builder.setTxPowerLevel(value)
}
/**
* <code>optional int32 tx_power_level = 10;</code>
*/
fun clearTxPowerLevel() {
_builder.clearTxPowerLevel()
}
/**
* <code>optional int32 tx_power_level = 10;</code>
* @return Whether the txPowerLevel field is set.
*/
fun hasTxPowerLevel(): kotlin.Boolean {
return _builder.hasTxPowerLevel()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.proto.Advertisement.copy(block: dev.yanshouwang.bluetooth_low_energy.proto.AdvertisementKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.Advertisement =
dev.yanshouwang.bluetooth_low_energy.proto.AdvertisementKt.Dsl._create(this.toBuilder()).apply { block() }._build()
val dev.yanshouwang.bluetooth_low_energy.proto.AdvertisementOrBuilder.uuidOrNull: dev.yanshouwang.bluetooth_low_energy.proto.UUID?
get() = if (hasUuid()) getUuid() else null

View File

@ -0,0 +1,46 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
@kotlin.jvm.JvmName("-initializebluetoothLowEnergyException")
inline fun bluetoothLowEnergyException(block: dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyExceptionKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException =
dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyExceptionKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.newBuilder()).apply { block() }._build()
object BluetoothLowEnergyExceptionKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
private val _builder: dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException = _builder.build()
/**
* <code>string message = 1;</code>
*/
var message: kotlin.String
@JvmName("getMessage")
get() = _builder.getMessage()
@JvmName("setMessage")
set(value) {
_builder.setMessage(value)
}
/**
* <code>string message = 1;</code>
*/
fun clearMessage() {
_builder.clearMessage()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException.copy(block: dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyExceptionKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyException =
dev.yanshouwang.bluetooth_low_energy.proto.BluetoothLowEnergyExceptionKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -0,0 +1,141 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
@kotlin.jvm.JvmName("-initializegattCharacteristic")
inline fun gattCharacteristic(block: dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristicKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic =
dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristicKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.newBuilder()).apply { block() }._build()
object GattCharacteristicKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
private val _builder: dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic = _builder.build()
/**
* <code>int64 id = 1;</code>
*/
var id: kotlin.Long
@JvmName("getId")
get() = _builder.getId()
@JvmName("setId")
set(value) {
_builder.setId(value)
}
/**
* <code>int64 id = 1;</code>
*/
fun clearId() {
_builder.clearId()
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
var uuid: dev.yanshouwang.bluetooth_low_energy.proto.UUID
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
fun hasUuid(): kotlin.Boolean {
return _builder.hasUuid()
}
/**
* <code>bool can_read = 3;</code>
*/
var canRead: kotlin.Boolean
@JvmName("getCanRead")
get() = _builder.getCanRead()
@JvmName("setCanRead")
set(value) {
_builder.setCanRead(value)
}
/**
* <code>bool can_read = 3;</code>
*/
fun clearCanRead() {
_builder.clearCanRead()
}
/**
* <code>bool can_write = 4;</code>
*/
var canWrite: kotlin.Boolean
@JvmName("getCanWrite")
get() = _builder.getCanWrite()
@JvmName("setCanWrite")
set(value) {
_builder.setCanWrite(value)
}
/**
* <code>bool can_write = 4;</code>
*/
fun clearCanWrite() {
_builder.clearCanWrite()
}
/**
* <code>bool can_write_without_response = 5;</code>
*/
var canWriteWithoutResponse: kotlin.Boolean
@JvmName("getCanWriteWithoutResponse")
get() = _builder.getCanWriteWithoutResponse()
@JvmName("setCanWriteWithoutResponse")
set(value) {
_builder.setCanWriteWithoutResponse(value)
}
/**
* <code>bool can_write_without_response = 5;</code>
*/
fun clearCanWriteWithoutResponse() {
_builder.clearCanWriteWithoutResponse()
}
/**
* <code>bool can_notify = 6;</code>
*/
var canNotify: kotlin.Boolean
@JvmName("getCanNotify")
get() = _builder.getCanNotify()
@JvmName("setCanNotify")
set(value) {
_builder.setCanNotify(value)
}
/**
* <code>bool can_notify = 6;</code>
*/
fun clearCanNotify() {
_builder.clearCanNotify()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic.copy(block: dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristicKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristic =
dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristicKt.Dsl._create(this.toBuilder()).apply { block() }._build()
val dev.yanshouwang.bluetooth_low_energy.proto.GattCharacteristicOrBuilder.uuidOrNull: dev.yanshouwang.bluetooth_low_energy.proto.UUID?
get() = if (hasUuid()) getUuid() else null

View File

@ -0,0 +1,73 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
@kotlin.jvm.JvmName("-initializegattDescriptor")
inline fun gattDescriptor(block: dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptorKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor =
dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptorKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.newBuilder()).apply { block() }._build()
object GattDescriptorKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
private val _builder: dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor = _builder.build()
/**
* <code>int64 id = 1;</code>
*/
var id: kotlin.Long
@JvmName("getId")
get() = _builder.getId()
@JvmName("setId")
set(value) {
_builder.setId(value)
}
/**
* <code>int64 id = 1;</code>
*/
fun clearId() {
_builder.clearId()
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
var uuid: dev.yanshouwang.bluetooth_low_energy.proto.UUID
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
fun hasUuid(): kotlin.Boolean {
return _builder.hasUuid()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor.copy(block: dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptorKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptor =
dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptorKt.Dsl._create(this.toBuilder()).apply { block() }._build()
val dev.yanshouwang.bluetooth_low_energy.proto.GattDescriptorOrBuilder.uuidOrNull: dev.yanshouwang.bluetooth_low_energy.proto.UUID?
get() = if (hasUuid()) getUuid() else null

View File

@ -0,0 +1,73 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
@kotlin.jvm.JvmName("-initializegattService")
inline fun gattService(block: dev.yanshouwang.bluetooth_low_energy.proto.GattServiceKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.GattService =
dev.yanshouwang.bluetooth_low_energy.proto.GattServiceKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.proto.GattService.newBuilder()).apply { block() }._build()
object GattServiceKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
private val _builder: dev.yanshouwang.bluetooth_low_energy.proto.GattService.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.proto.GattService.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.proto.GattService = _builder.build()
/**
* <code>int64 id = 1;</code>
*/
var id: kotlin.Long
@JvmName("getId")
get() = _builder.getId()
@JvmName("setId")
set(value) {
_builder.setId(value)
}
/**
* <code>int64 id = 1;</code>
*/
fun clearId() {
_builder.clearId()
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
var uuid: dev.yanshouwang.bluetooth_low_energy.proto.UUID
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>.proto.UUID uuid = 2;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
/**
* <code>.proto.UUID uuid = 2;</code>
* @return Whether the uuid field is set.
*/
fun hasUuid(): kotlin.Boolean {
return _builder.hasUuid()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.proto.GattService.copy(block: dev.yanshouwang.bluetooth_low_energy.proto.GattServiceKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.GattService =
dev.yanshouwang.bluetooth_low_energy.proto.GattServiceKt.Dsl._create(this.toBuilder()).apply { block() }._build()
val dev.yanshouwang.bluetooth_low_energy.proto.GattServiceOrBuilder.uuidOrNull: dev.yanshouwang.bluetooth_low_energy.proto.UUID?
get() = if (hasUuid()) getUuid() else null

View File

@ -0,0 +1,63 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
@kotlin.jvm.JvmName("-initializeperipheral")
inline fun peripheral(block: dev.yanshouwang.bluetooth_low_energy.proto.PeripheralKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.Peripheral =
dev.yanshouwang.bluetooth_low_energy.proto.PeripheralKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.newBuilder()).apply { block() }._build()
object PeripheralKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
private val _builder: dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.proto.Peripheral = _builder.build()
/**
* <code>int64 id = 1;</code>
*/
var id: kotlin.Long
@JvmName("getId")
get() = _builder.getId()
@JvmName("setId")
set(value) {
_builder.setId(value)
}
/**
* <code>int64 id = 1;</code>
*/
fun clearId() {
_builder.clearId()
}
/**
* <code>int32 maximum_write_length = 2;</code>
*/
var maximumWriteLength: kotlin.Int
@JvmName("getMaximumWriteLength")
get() = _builder.getMaximumWriteLength()
@JvmName("setMaximumWriteLength")
set(value) {
_builder.setMaximumWriteLength(value)
}
/**
* <code>int32 maximum_write_length = 2;</code>
*/
fun clearMaximumWriteLength() {
_builder.clearMaximumWriteLength()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.proto.Peripheral.copy(block: dev.yanshouwang.bluetooth_low_energy.proto.PeripheralKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.Peripheral =
dev.yanshouwang.bluetooth_low_energy.proto.PeripheralKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -0,0 +1,73 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
@kotlin.jvm.JvmName("-initializeserviceData")
inline fun serviceData(block: dev.yanshouwang.bluetooth_low_energy.proto.ServiceDataKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.ServiceData =
dev.yanshouwang.bluetooth_low_energy.proto.ServiceDataKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.newBuilder()).apply { block() }._build()
object ServiceDataKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
private val _builder: dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.proto.ServiceData = _builder.build()
/**
* <code>.proto.UUID uuid = 1;</code>
*/
var uuid: dev.yanshouwang.bluetooth_low_energy.proto.UUID
@JvmName("getUuid")
get() = _builder.getUuid()
@JvmName("setUuid")
set(value) {
_builder.setUuid(value)
}
/**
* <code>.proto.UUID uuid = 1;</code>
*/
fun clearUuid() {
_builder.clearUuid()
}
/**
* <code>.proto.UUID uuid = 1;</code>
* @return Whether the uuid field is set.
*/
fun hasUuid(): kotlin.Boolean {
return _builder.hasUuid()
}
/**
* <code>bytes data = 2;</code>
*/
var data: com.google.protobuf.ByteString
@JvmName("getData")
get() = _builder.getData()
@JvmName("setData")
set(value) {
_builder.setData(value)
}
/**
* <code>bytes data = 2;</code>
*/
fun clearData() {
_builder.clearData()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.proto.ServiceData.copy(block: dev.yanshouwang.bluetooth_low_energy.proto.ServiceDataKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.ServiceData =
dev.yanshouwang.bluetooth_low_energy.proto.ServiceDataKt.Dsl._create(this.toBuilder()).apply { block() }._build()
val dev.yanshouwang.bluetooth_low_energy.proto.ServiceDataOrBuilder.uuidOrNull: dev.yanshouwang.bluetooth_low_energy.proto.UUID?
get() = if (hasUuid()) getUuid() else null

View File

@ -0,0 +1,46 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
@kotlin.jvm.JvmName("-initializeuUID")
inline fun uUID(block: dev.yanshouwang.bluetooth_low_energy.proto.UUIDKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.UUID =
dev.yanshouwang.bluetooth_low_energy.proto.UUIDKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.proto.UUID.newBuilder()).apply { block() }._build()
object UUIDKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
class Dsl private constructor(
private val _builder: dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.proto.UUID.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.proto.UUID = _builder.build()
/**
* <code>string value = 1;</code>
*/
var value: kotlin.String
@JvmName("getValue")
get() = _builder.getValue()
@JvmName("setValue")
set(value) {
_builder.setValue(value)
}
/**
* <code>string value = 1;</code>
*/
fun clearValue() {
_builder.clearValue()
}
}
}
@kotlin.jvm.JvmSynthetic
inline fun dev.yanshouwang.bluetooth_low_energy.proto.UUID.copy(block: dev.yanshouwang.bluetooth_low_energy.proto.UUIDKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.UUID =
dev.yanshouwang.bluetooth_low_energy.proto.UUIDKt.Dsl._create(this.toBuilder()).apply { block() }._build()

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart Packages" level="project" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
</component>
</module>

1
example/.gitignore vendored
View File

@ -8,6 +8,7 @@
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml

View File

@ -1,10 +0,0 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 02c026b03cd31dd3f867e5faeb7e104cce174c5f
channel: stable
project_type: app

View File

@ -8,9 +8,9 @@ This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

View File

@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks

View File

@ -1,8 +1,7 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader)
}
}
@ -26,16 +25,29 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "dev.yanshouwang.bluetooth_low_energy_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.yanshouwang.bluetooth_low_energy_example">
<!-- Flutter needs it to communicate with the running application
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>

View File

@ -2,9 +2,11 @@
package="dev.yanshouwang.bluetooth_low_energy_example">
<application
android:label="bluetooth_low_energy_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@ -18,15 +20,6 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

View File

@ -3,7 +3,7 @@
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.

View File

@ -3,7 +3,7 @@
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.yanshouwang.bluetooth_low_energy_example">
<!-- Flutter needs it to communicate with the running application
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>

View File

@ -1,13 +1,12 @@
buildscript {
ext.kotlin_version = '1.5.21'
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
maven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@ -16,13 +15,14 @@ allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/' }
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

View File

@ -3,5 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,4 @@
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside

View File

@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>11.0</string>
</dict>
</plist>

View File

@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@ -1,9 +1,9 @@
PODS:
- bluetooth_low_energy (0.0.1):
- Flutter
- SwiftProtobuf (~> 1.0)
- SwiftProtobuf (~> 1.20)
- Flutter (1.0.0)
- SwiftProtobuf (1.17.0)
- SwiftProtobuf (1.20.1)
DEPENDENCIES:
- bluetooth_low_energy (from `.symlinks/plugins/bluetooth_low_energy/ios`)
@ -20,10 +20,10 @@ EXTERNAL SOURCES:
:path: Flutter
SPEC CHECKSUMS:
bluetooth_low_energy: 9222b99f977897165e6ffaece386bd289ac8c1fb
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
SwiftProtobuf: 9c85136c6ba74b0a1b84279dbf0f6db8efb714e0
bluetooth_low_energy: af34d921ca3a9e085cf6364c500050965acf25f9
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
SwiftProtobuf: e40a7684079620e84ba522dbaeab0cddb0ec7ffd
PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
COCOAPODS: 1.10.1
COCOAPODS: 1.11.3

View File

@ -13,7 +13,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
EA280E36114EEC52A66510AF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2F6363DB0F6B8F760A0B70E6 /* Pods_Runner.framework */; };
BC25F992B6ECFCC18D953308 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3248507C6DD52333A770C1CB /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -30,11 +30,11 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1173070BE6CFE927D74C0736 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
2F6363DB0F6B8F760A0B70E6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3248507C6DD52333A770C1CB /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
5CB2CF9D872B54AC77EFD5AD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@ -45,8 +45,8 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9E8C4C982EC9200D28D9557C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
FA6DAFE6FDB9F8D1C4A8AEF3 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
AEA309A3A59074B58910681F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
C3AC24B274EC26E645389946 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -54,13 +54,21 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
EA280E36114EEC52A66510AF /* Pods_Runner.framework in Frameworks */,
BC25F992B6ECFCC18D953308 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
2B77126ACFA0B323BF67EC4C /* Frameworks */ = {
isa = PBXGroup;
children = (
3248507C6DD52333A770C1CB /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
@ -78,8 +86,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
A19CF493038BEE74587FB0E8 /* Pods */,
990CDB7BA621E0B7AFA0C6BE /* Frameworks */,
F7511A57B6D81C59C9E0353E /* Pods */,
2B77126ACFA0B323BF67EC4C /* Frameworks */,
);
sourceTree = "<group>";
};
@ -106,20 +114,12 @@
path = Runner;
sourceTree = "<group>";
};
990CDB7BA621E0B7AFA0C6BE /* Frameworks */ = {
F7511A57B6D81C59C9E0353E /* Pods */ = {
isa = PBXGroup;
children = (
2F6363DB0F6B8F760A0B70E6 /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
A19CF493038BEE74587FB0E8 /* Pods */ = {
isa = PBXGroup;
children = (
FA6DAFE6FDB9F8D1C4A8AEF3 /* Pods-Runner.debug.xcconfig */,
1173070BE6CFE927D74C0736 /* Pods-Runner.release.xcconfig */,
9E8C4C982EC9200D28D9557C /* Pods-Runner.profile.xcconfig */,
AEA309A3A59074B58910681F /* Pods-Runner.debug.xcconfig */,
C3AC24B274EC26E645389946 /* Pods-Runner.release.xcconfig */,
5CB2CF9D872B54AC77EFD5AD /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
@ -131,14 +131,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
4DEF012D22BCBC3AF731DE9C /* [CP] Check Pods Manifest.lock */,
224727E4C00C24BC3CD4292A /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
EDB3731BEABF1E16CE6A52EB /* [CP] Embed Pods Frameworks */,
DCBB4C37F33FFC666159F299 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@ -197,21 +197,7 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
4DEF012D22BCBC3AF731DE9C /* [CP] Check Pods Manifest.lock */ = {
224727E4C00C24BC3CD4292A /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@ -233,6 +219,20 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -247,7 +247,7 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
EDB3731BEABF1E16CE6A52EB /* [CP] Embed Pods Frameworks */ = {
DCBB4C37F33FFC666159F299 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@ -339,7 +339,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@ -417,7 +417,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@ -466,7 +466,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@ -38,8 +36,8 @@
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@ -61,8 +59,6 @@
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"

View File

@ -2,8 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Bluetooth Low Energy</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@ -23,7 +27,7 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>We need to use your bluetooth to communicate with other BLE devices.</string>
<string>Let's try to communicate use the bluetooth low energy!</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>

Some files were not shown because too many files have changed in this diff Show More