feat: 重构项目 2.0.0 (#6)

* feat: 重构项目

* feat: 添加 bluez_central_manager

* feat: 联合插件

* feat: 拆分项目

* feat: 实现 linux 部分接口

* feat: 重新创建项目

* feat: 定义接口

* feat: 实现接入插件

* feat: 清空接入插件示例代码

* feat: 开发 linux 插件

* feat: 调整接口

* 临时提交

* feat: 实现 Android 接口

* fix: 修复 Android 问题

* fix: 移除多余文件

* feat: 重构项目 (#5)

* fix: 移除多余的状态判断

* fix: 外围设备断开时检查是否存在未完成的操作

* feat: 尝试使用 win32 实现接口

* fix: 修复大小写问题

* feat: 实现 macOS 接口

* feat: 实现 macOS 接口

* fix:支持使用16位短字符串生成UUID

* fix: 修复未清理已完成操作的问题

* fix: 规范命名

* 添加蓝牙使用描述

* fix: 更新 README.md
This commit is contained in:
Mr剑侠客
2023-08-17 17:49:26 +08:00
committed by GitHub
parent 3abe9d5b3d
commit d1726b52fa
371 changed files with 15666 additions and 15993 deletions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022 yanshouwang
Copyright (c) 2021 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,43 +1,5 @@
# bluetooth_low_energy
A bluetooth low energy plugin for flutter, which can be used to develope central role apps.
This repo contains the source code for the [`bluetooth_low_energy`][1] federated plugins.
## Features
### Central APIs
- [x] Scan advertisements.
- [x] Connect/Disconnect to peripherals.
- [x] Read/Write/Notify characteristics.
- [x] Read/Write descriptors.
### Peripheral APIs
- [ ] Add/Send advertisements.
- [ ] Add services
- [ ] Add/Listen/Write characteristics
- [ ] Add/Listen/Write descriptors.
- [ ] Listen GATT connect/disconnect events.
## Getting Started
Add `bluetooth_low_energy` as a [dependency in your pubspec.yaml file](https://flutter.dev/using-packages/).
```
dependencies:
bluetooth_low_energy: ^<latest-version>
```
*Note*: Bluetooth Low Energy doesn't work on Android emulators, so use physical devices which has bluetooth features for development.
### Android
Make sure you have a `miniSdkVersion` with 21 or higher in your `android/app/build.gradle` file.
### iOS
Make sure you have a minimum deployment target of 9.0 or above, you can uncomment the first line `platform :ios, '9.0'` in your iOS project's `Podfile`.
*Note*: According to Apple's [documents](https://developer.apple.com/documentation/corebluetooth/), you must include the [`NSBluetoothAlwaysUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothalwaysusagedescription) on or after iOS 13, and include the [`NSBluetoothPeripheralUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothperipheralusagedescription) key before iOS 13.
## Issues
- Peripheral APIs are not implemented yet.
[1]: https://pub.dev/packages/bluetooth_low_energy

View File

@ -1,18 +0,0 @@
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"
- "**/*.mocks.dart"
- "**/*.pb.dart"
- "**/*.pbenum.dart"
- "**/*.pbjson.dart"
- "**/*.pbserver.dart"
linter:
rules:
prefer_single_quotes: true
require_trailing_commas: true

View File

@ -1,809 +0,0 @@
// Autogenerated from Pigeon (v4.2.0), 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 Messages {
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 startScan(@Nullable List<byte[]> uuidBuffers, Result<Void> result);
void stopScan();
/** 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.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);
}
}
}
}
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 onStateChanged(@NonNull Long stateNumberArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerFlutterApi.onStateChanged", getCodec());
channel.send(new ArrayList<Object>(Arrays.asList(stateNumberArg)), channelReply -> {
callback.reply(null);
});
}
public void onScanned(@NonNull byte[] broadcastBufferArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CentralManagerFlutterApi.onScanned", getCodec());
channel.send(new ArrayList<Object>(Arrays.asList(broadcastBufferArg)), 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 free(@NonNull String id);
void connect(@NonNull String id, Result<Void> result);
void disconnect(@NonNull String id, Result<Void> result);
void requestMtu(@NonNull String id, Result<Long> result);
void discoverServices(@NonNull String 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.free", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
String idArg = (String)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
api.free(idArg);
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.connect", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
String idArg = (String)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.connect(idArg, 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.disconnect", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
String idArg = (String)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, 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.requestMtu", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
String idArg = (String)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
Result<Long> resultCallback = new Result<Long>() {
public void success(Long result) {
wrapped.put("result", result);
reply.reply(wrapped);
}
public void error(Throwable error) {
wrapped.put("error", wrapError(error));
reply.reply(wrapped);
}
};
api.requestMtu(idArg, 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;
String idArg = (String)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, 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 onConnectionLost(@NonNull String idArg, @NonNull String errorMessageArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.PeripheralFlutterApi.onConnectionLost", getCodec());
channel.send(new ArrayList<Object>(Arrays.asList(idArg, errorMessageArg)), 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 free(@NonNull String id);
void discoverCharacteristics(@NonNull String 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.free", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
String idArg = (String)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
api.free(idArg);
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;
String idArg = (String)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, 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 free(@NonNull String id);
void discoverDescriptors(@NonNull String id, Result<List<byte[]>> result);
void read(@NonNull String id, Result<byte[]> result);
void write(@NonNull String id, @NonNull byte[] value, @NonNull Boolean withoutResponse, Result<Void> result);
void setNotify(@NonNull String 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.free", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
String idArg = (String)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
api.free(idArg);
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;
String idArg = (String)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, 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;
String idArg = (String)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, 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;
String idArg = (String)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, 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;
String idArg = (String)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, 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 onValueChanged(@NonNull String idArg, @NonNull byte[] valueArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.GattCharacteristicFlutterApi.onValueChanged", 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 free(@NonNull String id);
void read(@NonNull String id, Result<byte[]> result);
void write(@NonNull String 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.free", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
String idArg = (String)args.get(0);
if (idArg == null) {
throw new NullPointerException("idArg unexpectedly null.");
}
api.free(idArg);
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;
String idArg = (String)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, 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;
String idArg = (String)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, valueArg, resultCallback);
}
catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
}
});
} else {
channel.setMessageHandler(null);
}
}
}
}
@NonNull private static Map<String, Object> wrapError(@NonNull 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

@ -1,122 +0,0 @@
// 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

@ -1,153 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
public interface BroadcastOrBuilder extends
// @@protoc_insertion_point(interface_extends:proto.Broadcast)
com.google.protobuf.MessageOrBuilder {
/**
* <code>.proto.Peripheral peripheral = 1;</code>
* @return Whether the peripheral field is set.
*/
boolean hasPeripheral();
/**
* <code>.proto.Peripheral peripheral = 1;</code>
* @return The peripheral.
*/
dev.yanshouwang.bluetooth_low_energy.proto.Peripheral getPeripheral();
/**
* <code>.proto.Peripheral peripheral = 1;</code>
*/
dev.yanshouwang.bluetooth_low_energy.proto.PeripheralOrBuilder getPeripheralOrBuilder();
/**
* <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

@ -1,60 +0,0 @@
// 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>string id = 1;</code>
* @return The id.
*/
java.lang.String getId();
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
com.google.protobuf.ByteString
getIdBytes();
/**
* <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

@ -1,747 +0,0 @@
// 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() {
id_ = "";
}
@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 10: {
java.lang.String s = input.readStringRequireUtf8();
id_ = s;
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 volatile java.lang.Object id_;
/**
* <code>string id = 1;</code>
* @return The id.
*/
@java.lang.Override
public java.lang.String getId() {
java.lang.Object ref = id_;
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();
id_ = s;
return s;
}
}
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(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()
.equals(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) + getId().hashCode();
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_ = "";
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().isEmpty()) {
id_ = other.id_;
onChanged();
}
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 java.lang.Object id_ = "";
/**
* <code>string id = 1;</code>
* @return The id.
*/
public java.lang.String getId() {
java.lang.Object ref = id_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
id_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string id = 1;</code>
* @param value The id to set.
* @return This builder for chaining.
*/
public Builder setId(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
id_ = value;
onChanged();
return this;
}
/**
* <code>string id = 1;</code>
* @return This builder for chaining.
*/
public Builder clearId() {
id_ = getDefaultInstance().getId();
onChanged();
return this;
}
/**
* <code>string id = 1;</code>
* @param value The bytes for id to set.
* @return This builder for chaining.
*/
public Builder setIdBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
id_ = value;
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

@ -1,36 +0,0 @@
// 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>string id = 1;</code>
* @return The id.
*/
java.lang.String getId();
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
com.google.protobuf.ByteString
getIdBytes();
/**
* <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

@ -1,747 +0,0 @@
// 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() {
id_ = "";
}
@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 10: {
java.lang.String s = input.readStringRequireUtf8();
id_ = s;
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 volatile java.lang.Object id_;
/**
* <code>string id = 1;</code>
* @return The id.
*/
@java.lang.Override
public java.lang.String getId() {
java.lang.Object ref = id_;
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();
id_ = s;
return s;
}
}
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(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()
.equals(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) + getId().hashCode();
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_ = "";
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().isEmpty()) {
id_ = other.id_;
onChanged();
}
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 java.lang.Object id_ = "";
/**
* <code>string id = 1;</code>
* @return The id.
*/
public java.lang.String getId() {
java.lang.Object ref = id_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
id_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string id = 1;</code>
* @param value The id to set.
* @return This builder for chaining.
*/
public Builder setId(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
id_ = value;
onChanged();
return this;
}
/**
* <code>string id = 1;</code>
* @return This builder for chaining.
*/
public Builder clearId() {
id_ = getDefaultInstance().getId();
onChanged();
return this;
}
/**
* <code>string id = 1;</code>
* @param value The bytes for id to set.
* @return This builder for chaining.
*/
public Builder setIdBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
id_ = value;
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

@ -1,36 +0,0 @@
// 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>string id = 1;</code>
* @return The id.
*/
java.lang.String getId();
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
com.google.protobuf.ByteString
getIdBytes();
/**
* <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

@ -1,136 +0,0 @@
// 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_Broadcast_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_proto_Broadcast_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;
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\"\361\002\n\tBroadc" +
"ast\022%\n\nperipheral\030\001 \001(\0132\021.proto.Peripher" +
"al\022\014\n\004rssi\030\002 \001(\005\022\030\n\013connectable\030\003 \001(\010H\000\210" +
"\001\001\022\014\n\004data\030\004 \001(\014\022\027\n\nlocal_name\030\005 \001(\tH\001\210\001" +
"\001\022\"\n\032manufacturer_specific_data\030\006 \001(\014\022)\n" +
"\rservice_datas\030\007 \003(\0132\022.proto.ServiceData" +
"\022\"\n\rservice_uuids\030\010 \003(\0132\013.proto.UUID\022,\n\027" +
"solicited_service_uuids\030\t \003(\0132\013.proto.UU" +
"ID\022\033\n\016tx_power_level\030\n \001(\005H\002\210\001\001B\016\n\014_conn" +
"ectableB\r\n\013_local_nameB\021\n\017_tx_power_leve" +
"l\"3\n\nPeripheral\022\n\n\002id\030\001 \001(\t\022\031\n\004uuid\030\002 \001(" +
"\0132\013.proto.UUID\"4\n\013GattService\022\n\n\002id\030\001 \001(" +
"\t\022\031\n\004uuid\030\002 \001(\0132\013.proto.UUID\"\230\001\n\022GattCha" +
"racteristic\022\n\n\002id\030\001 \001(\t\022\031\n\004uuid\030\002 \001(\0132\013." +
"proto.UUID\022\020\n\010can_read\030\003 \001(\010\022\021\n\tcan_writ" +
"e\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\016GattDescripto" +
"r\022\n\n\002id\030\001 \001(\t\022\031\n\004uuid\030\002 \001(\0132\013.proto.UUID" +
"\"\025\n\004UUID\022\r\n\005value\030\001 \001(\t\"6\n\013ServiceData\022\031" +
"\n\004uuid\030\001 \001(\0132\013.proto.UUID\022\014\n\004data\030\002 \001(\014*" +
"r\n\016BluetoothState\022\037\n\033BLUETOOTH_STATE_UNS" +
"UPPORTED\020\000\022\037\n\033BLUETOOTH_STATE_POWERED_OF" +
"F\020\001\022\036\n\032BLUETOOTH_STATE_POWERED_ON\020\002B.\n*d" +
"ev.yanshouwang.bluetooth_low_energy.prot" +
"oP\001b\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
internal_static_proto_Broadcast_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_proto_Broadcast_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_proto_Broadcast_descriptor,
new java.lang.String[] { "Peripheral", "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", "Uuid", });
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", });
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -1,747 +0,0 @@
// 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() {
id_ = "";
}
@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 10: {
java.lang.String s = input.readStringRequireUtf8();
id_ = s;
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_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 volatile java.lang.Object id_;
/**
* <code>string id = 1;</code>
* @return The id.
*/
@java.lang.Override
public java.lang.String getId() {
java.lang.Object ref = id_;
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();
id_ = s;
return s;
}
}
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(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.Peripheral)) {
return super.equals(obj);
}
dev.yanshouwang.bluetooth_low_energy.proto.Peripheral other = (dev.yanshouwang.bluetooth_low_energy.proto.Peripheral) obj;
if (!getId()
.equals(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) + getId().hashCode();
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.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_ = "";
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_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_;
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.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().isEmpty()) {
id_ = other.id_;
onChanged();
}
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.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 java.lang.Object id_ = "";
/**
* <code>string id = 1;</code>
* @return The id.
*/
public java.lang.String getId() {
java.lang.Object ref = id_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
id_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string id = 1;</code>
* @param value The id to set.
* @return This builder for chaining.
*/
public Builder setId(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
id_ = value;
onChanged();
return this;
}
/**
* <code>string id = 1;</code>
* @return This builder for chaining.
*/
public Builder clearId() {
id_ = getDefaultInstance().getId();
onChanged();
return this;
}
/**
* <code>string id = 1;</code>
* @param value The bytes for id to set.
* @return This builder for chaining.
*/
public Builder setIdBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
id_ = value;
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.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

@ -1,36 +0,0 @@
// 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>string id = 1;</code>
* @return The id.
*/
java.lang.String getId();
/**
* <code>string id = 1;</code>
* @return The bytes for id.
*/
com.google.protobuf.ByteString
getIdBytes();
/**
* <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

@ -1,677 +0,0 @@
// 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

@ -1,30 +0,0 @@
// 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

@ -1,559 +0,0 @@
// 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

@ -1,21 +0,0 @@
// 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

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

View File

@ -1,185 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
import android.bluetooth.BluetoothManager
import android.bluetooth.le.ScanRecord
import android.content.Context
import android.content.IntentFilter
import android.content.pm.PackageManager
import android.os.Handler
import android.util.Log
import androidx.core.content.ContextCompat
import dev.yanshouwang.bluetooth_low_energy.proto.BluetoothState
import dev.yanshouwang.bluetooth_low_energy.proto.UUID
import dev.yanshouwang.bluetooth_low_energy.proto.uUID
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.embedding.engine.plugins.activity.ActivityAware
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
import java.util.concurrent.Executor
import dev.yanshouwang.bluetooth_low_energy.pigeon.Messages as Pigeon
/** BluetoothLowEnergyPlugin */
class BluetoothLowEnergyPlugin : FlutterPlugin, ActivityAware {
override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) {
val binaryMessenger = binding.binaryMessenger
instances[KEY_CENTRAL_MANAGER_FLUTTER_API] = Pigeon.CentralManagerFlutterApi(binaryMessenger)
instances[KEY_PERIPHERAL_FLUTTER_API] = Pigeon.PeripheralFlutterApi(binaryMessenger)
instances[KEY_GATT_CHARACTERISTIC_FLUTTER_API] = Pigeon.GattCharacteristicFlutterApi(binaryMessenger)
Pigeon.CentralManagerHostApi.setup(binaryMessenger, MyCentralManagerHostApi)
Pigeon.PeripheralHostApi.setup(binaryMessenger, MyPeripheralHostApi)
Pigeon.GattServiceHostApi.setup(binaryMessenger, MyGattServiceHostApi)
Pigeon.GattCharacteristicHostApi.setup(binaryMessenger, MyGattCharacteristicHostApi)
Pigeon.GattDescriptorHostApi.setup(binaryMessenger, MyGattDescriptorHostApi)
}
override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
val binaryMessenger = binding.binaryMessenger
instances.remove(KEY_CENTRAL_MANAGER_FLUTTER_API)
instances.remove(KEY_PERIPHERAL_FLUTTER_API)
instances.remove(KEY_GATT_CHARACTERISTIC_FLUTTER_API)
Pigeon.CentralManagerHostApi.setup(binaryMessenger, null)
Pigeon.PeripheralHostApi.setup(binaryMessenger, null)
Pigeon.GattServiceHostApi.setup(binaryMessenger, null)
Pigeon.GattCharacteristicHostApi.setup(binaryMessenger, null)
Pigeon.GattDescriptorHostApi.setup(binaryMessenger, null)
}
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
instances[KEY_ACTIVITY_PLUGIN_BINDING] = binding
binding.addRequestPermissionsResultListener(MyRequestPermissionsResultListener)
// Register the central manager state changed receiver.
val filter = IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED)
activity.registerReceiver(MyBroadcastReceiver, filter)
}
override fun onDetachedFromActivityForConfigChanges() {
onDetachedFromActivity()
}
override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) {
onAttachedToActivity(binding)
}
override fun onDetachedFromActivity() {
// Unregister the central manager state changed receiver.
activity.unregisterReceiver(MyBroadcastReceiver)
val binding = instances.remove(KEY_ACTIVITY_PLUGIN_BINDING) as ActivityPluginBinding
binding.removeRequestPermissionsResultListener(MyRequestPermissionsResultListener)
}
}
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 KEY_COUNT = "KEY_COUNT"
const val KEY_DEVICE = "KEY_DEVICE"
const val KEY_GATT = "KEY_GATT"
const val KEY_SERVICE = "KEY_SERVICE"
const val KEY_CHARACTERISTIC = "KEY_CHARACTERISTIC"
const val KEY_DESCRIPTOR = "KEY_DESCRIPTOR"
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_REQUEST_MTU_RESULT = "KEY_REQUEST_MTU_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"
val instances = mutableMapOf<String, Any>()
val activity get() = (instances[KEY_ACTIVITY_PLUGIN_BINDING] as ActivityPluginBinding).activity
val centralFlutterApi get() = instances[KEY_CENTRAL_MANAGER_FLUTTER_API] as Pigeon.CentralManagerFlutterApi
val peripheralFlutterApi get() = instances[KEY_PERIPHERAL_FLUTTER_API] as Pigeon.PeripheralFlutterApi
val characteristicFlutterApi get() = instances[KEY_GATT_CHARACTERISTIC_FLUTTER_API] as Pigeon.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)
fun register(id: String): MutableMap<String, Any> {
var items = instances[id] as MutableMap<String, Any>?
if (items == null) {
items = mutableMapOf()
instances[id] = items
Log.d(BluetoothLowEnergyPlugin::class.java.simpleName, "register: $id")
}
var count = items[KEY_COUNT] as Int? ?: 0
count += 1
items[KEY_COUNT] = count
return items
}
fun unregister(id: String): MutableMap<String, Any> {
val items = instances[id] as MutableMap<String, Any>
var count = items[KEY_COUNT] as Int
count -= 1
items[KEY_COUNT] = count
if (count < 1) {
instances.remove(id)
Log.d(BluetoothLowEnergyPlugin::class.java.simpleName, "unregister: $id")
}
return items
}
val Any.TAG: String get() = this::class.java.simpleName
val Int.stateNumber: Long
get() {
val state = when (this) {
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()
}
return state.number.toLong()
}
val BluetoothAdapter.stateNumber: Long
get() {
return if (bluetoothAvailable) {
state.stateNumber
} else {
BluetoothState.BLUETOOTH_STATE_UNSUPPORTED.number.toLong()
}
}
val BluetoothDevice.uuid: UUID
get() {
val node = address.filter { char -> char != ':' }.lowercase()
// We don't know the timestamp of the bluetooth device, use nil UUID as prefix.
return uUID {
this.value = "00000000-0000-0000-$node"
}
}
//val UUID.address: String
// get() = value.takeLast(12).chunked(2).joinToString(":").uppercase()
val ScanRecord.rawManufacturerSpecificData: ByteArray?
get() {
var begin = 0
while (begin < bytes.size) {
val length = bytes[begin++].toInt() and 0xff
if (length == 0) {
break
}
val end = begin + length
val type = bytes[begin++].toInt() and 0xff
if (type == MyScanCallback.DATA_TYPE_MANUFACTURER_SPECIFIC_DATA) {
return bytes.slice(begin until end).toByteArray()
}
begin = end
}
return null
}

View File

@ -1,179 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.*
import android.util.Log
import dev.yanshouwang.bluetooth_low_energy.pigeon.Messages as Pigeon
import dev.yanshouwang.bluetooth_low_energy.proto.gattService
import dev.yanshouwang.bluetooth_low_energy.proto.uUID
// TODO: Clear results when connection state changed or central manager state changed.
object MyBluetoothGattCallback : BluetoothGattCallback() {
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
super.onConnectionStateChange(gatt, status, newState)
Log.d(TAG, "onConnectionStateChange: $gatt, $status, $newState")
val id = gatt.device.hashCode().toString()
if (status == BluetoothGatt.GATT_SUCCESS) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
// Must be connected.
val result = instances.remove("$id/$KEY_CONNECT_RESULT") as Pigeon.Result<Void>
result.success(null)
} else {
// Must be disconnected.
gatt.close()
val result = instances.remove("$id/$KEY_DISCONNECT_RESULT") as Pigeon.Result<Void>
result.success(null)
}
} else {
gatt.close()
val result = instances.remove("$id/$KEY_CONNECT_RESULT") as Pigeon.Result<Void>?
if (result == null) {
// Connection lost.
val errorMessage = "GATT error with status: $status."
mainExecutor.execute {
peripheralFlutterApi.onConnectionLost(id, errorMessage) {}
}
} else {
// Connect failed.
val error = BluetoothLowEnergyException("GATT error with status: $status.")
result.error(error)
}
}
}
override fun onMtuChanged(gatt: BluetoothGatt, mtu: Int, status: Int) {
super.onMtuChanged(gatt, mtu, status)
Log.d(TAG, "onMtuChanged: $gatt, $mtu, $status")
val id = gatt.device.hashCode().toString()
// Maybe triggered in response to a connection event.
val result = instances.remove("$id/$KEY_REQUEST_MTU_RESULT") as Pigeon.Result<Long>? ?: return
when (status) {
BluetoothGatt.GATT_SUCCESS -> {
val maximumWriteLength = (mtu - 3).toLong()
result.success(maximumWriteLength)
}
else -> {
val error = BluetoothLowEnergyException("GATT request MTU failed with status: $status")
result.error(error)
}
}
}
override fun onServicesDiscovered(gatt: BluetoothGatt, status: Int) {
super.onServicesDiscovered(gatt, status)
Log.d(TAG, "onServicesDiscovered: $gatt, $status")
val id = gatt.device.hashCode().toString()
val result = instances.remove("$id/$KEY_DISCOVER_SERVICES_RESULT") as Pigeon.Result<MutableList<ByteArray>>
if (status == BluetoothGatt.GATT_SUCCESS) {
val serviceValues = mutableListOf<ByteArray>()
for (service in gatt.services) {
val serviceValue = registerService(gatt, service)
serviceValues.add(serviceValue)
}
result.success(serviceValues)
} else {
val error = BluetoothLowEnergyException("GATT discover services failed with status: $status")
result.error(error)
}
}
private fun registerService(gatt: BluetoothGatt, service: BluetoothGattService): ByteArray {
val id = service.hashCode().toString()
val items = register(id)
items[KEY_GATT] = gatt
items[KEY_SERVICE] = service
return gattService {
this.id = id
this.uuid = uUID {
this.value = service.uuid.toString()
}
}.toByteArray()
}
override fun onCharacteristicRead(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) {
super.onCharacteristicRead(gatt, characteristic, status)
Log.d(TAG, "onCharacteristicRead: $gatt, $characteristic, $status")
val id = characteristic.hashCode().toString()
val result = instances.remove("$id/$KEY_READ_RESULT") as Pigeon.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)
Log.d(TAG, "onCharacteristicWrite: $gatt, $characteristic, $status")
val id = characteristic.hashCode().toString()
val result = instances.remove("$id/$KEY_WRITE_RESULT") as Pigeon.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)
Log.d(TAG, "onCharacteristicChanged: $gatt, $characteristic")
val id = characteristic.hashCode().toString()
val value = characteristic.value
mainExecutor.execute {
characteristicFlutterApi.onValueChanged(id, value) {}
}
}
override fun onDescriptorRead(gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int) {
super.onDescriptorRead(gatt, descriptor, status)
Log.d(TAG, "onDescriptorRead: $gatt, $descriptor, $status")
val id = descriptor.hashCode().toString()
val result = instances.remove("$id/$KEY_READ_RESULT") as Pigeon.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)
Log.d(TAG, "onDescriptorWrite: $gatt, $descriptor, $status")
val id = descriptor.hashCode().toString()
val result = instances.remove("$id/$KEY_WRITE_RESULT") as Pigeon.Result<Void>
if (status == BluetoothGatt.GATT_SUCCESS) {
result.success(null)
} else {
val error = BluetoothLowEnergyException("GATT write descriptor failed with status: $status.")
result.error(error)
}
}
override fun onPhyRead(gatt: BluetoothGatt, txPhy: Int, rxPhy: Int, status: Int) {
super.onPhyRead(gatt, txPhy, rxPhy, status)
Log.d(TAG, "onPhyRead: $gatt, $txPhy, $rxPhy, $status")
}
override fun onPhyUpdate(gatt: BluetoothGatt, txPhy: Int, rxPhy: Int, status: Int) {
super.onPhyUpdate(gatt, txPhy, rxPhy, status)
Log.d(TAG, "onPhyUpdate: $gatt, $txPhy, $rxPhy, $status")
}
override fun onReadRemoteRssi(gatt: BluetoothGatt, rssi: Int, status: Int) {
super.onReadRemoteRssi(gatt, rssi, status)
Log.d(TAG, "onReadRemoteRssi: $gatt, $rssi, $status")
}
override fun onReliableWriteCompleted(gatt: BluetoothGatt, status: Int) {
super.onReliableWriteCompleted(gatt, status)
Log.d(TAG, "onReliableWriteCompleted: $gatt, $status")
}
override fun onServiceChanged(gatt: BluetoothGatt) {
super.onServiceChanged(gatt)
Log.d(TAG, "onServiceChanged: $gatt")
}
}

View File

@ -1,20 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothAdapter
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
object MyBroadcastReceiver : BroadcastReceiver() {
private const val STATE_UNKNOWN = -1
override fun onReceive(context: Context, intent: Intent) {
Log.d(TAG, "onReceive: $context, $intent")
val previousStateNumber =
intent.getIntExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE, STATE_UNKNOWN).stateNumber
val stateNumber = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, STATE_UNKNOWN).stateNumber
if (stateNumber == previousStateNumber) return
centralFlutterApi.onStateChanged(stateNumber) {}
}
}

View File

@ -1,64 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.le.ScanFilter
import android.bluetooth.le.ScanSettings
import android.content.pm.PackageManager
import android.os.Build
import android.os.ParcelUuid
import android.util.Log
import androidx.core.app.ActivityCompat
import dev.yanshouwang.bluetooth_low_energy.proto.UUID
import dev.yanshouwang.bluetooth_low_energy.pigeon.Messages as Pigeon
object MyCentralManagerHostApi : Pigeon.CentralManagerHostApi {
const val REQUEST_CODE = 443
override fun authorize(result: Pigeon.Result<Boolean>) {
Log.d(TAG, "authorize: ")
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)
instances[KEY_AUTHORIZE_RESULT] = result
}
}
override fun getState(): Long {
Log.d(TAG, "getState: ")
return bluetoothAdapter.stateNumber
}
override fun startScan(uuidBuffers: MutableList<ByteArray>?, result: Pigeon.Result<Void>) {
Log.d(TAG, "startScan: $uuidBuffers")
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 = instances.remove(KEY_START_SCAN_ERROR) as Throwable?
if (error == null) {
result.success(null)
} else {
result.error(error)
}
}
}
override fun stopScan() {
Log.d(TAG, "stopScan: ")
bluetoothAdapter.bluetoothLeScanner.stopScan(MyScanCallback)
}
}

View File

@ -1,111 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattCharacteristic
import android.bluetooth.BluetoothGattDescriptor
import android.util.Log
import dev.yanshouwang.bluetooth_low_energy.pigeon.Messages as Pigeon
import dev.yanshouwang.bluetooth_low_energy.proto.gattDescriptor
import dev.yanshouwang.bluetooth_low_energy.proto.uUID
import java.util.UUID
object MyGattCharacteristicHostApi : Pigeon.GattCharacteristicHostApi {
private const val CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb"
override fun free(id: String) {
Log.d(TAG, "free: $id")
unregister(id)
}
override fun discoverDescriptors(id: String, result: Pigeon.Result<MutableList<ByteArray>>) {
Log.d(TAG, "discoverDescriptors: $id")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
val characteristic = items[KEY_CHARACTERISTIC] as BluetoothGattCharacteristic
val descriptorValues = mutableListOf<ByteArray>()
for (descriptor in characteristic.descriptors) {
val descriptorValue = registerDescriptor(gatt, descriptor)
descriptorValues.add(descriptorValue)
}
result.success(descriptorValues)
}
private fun registerDescriptor(gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor): ByteArray {
val id = descriptor.hashCode().toString()
val items = register(id)
items[KEY_GATT] = gatt
items[KEY_DESCRIPTOR] = descriptor
return gattDescriptor {
this.id = id
this.uuid = uUID {
this.value = descriptor.uuid.toString()
}
}.toByteArray()
}
override fun read(id: String, result: Pigeon.Result<ByteArray>) {
Log.d(TAG, "read: $id")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
val characteristic = items[KEY_CHARACTERISTIC] as BluetoothGattCharacteristic
val succeed = gatt.readCharacteristic(characteristic)
if (succeed) {
instances["$id/$KEY_READ_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT read characteristic failed.")
result.error(error)
}
}
override fun write(id: String, value: ByteArray, withoutResponse: Boolean, result: Pigeon.Result<Void>) {
Log.d(TAG, "write: $id, $value")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
val characteristic = items[KEY_CHARACTERISTIC] 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) {
instances["$id/$KEY_WRITE_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT write characteristic failed.")
result.error(error)
}
}
override fun setNotify(id: String, value: Boolean, result: Pigeon.Result<Void>) {
Log.d(TAG, "setNotify: $id, $value")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
val characteristic = items[KEY_CHARACTERISTIC] as BluetoothGattCharacteristic
val succeed = gatt.setCharacteristicNotification(characteristic, value)
if (succeed) {
writeClientCharacteristicConfig(gatt, characteristic, value, result)
} else {
val error = BluetoothLowEnergyException("GATT set characteristic notification failed.")
result.error(error)
}
}
private fun writeClientCharacteristicConfig(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, value: Boolean, result: Pigeon.Result<Void>) {
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 succeed = gatt.writeDescriptor(descriptor)
if (succeed) {
val id = descriptor.hashCode().toString()
instances["$id/$KEY_WRITE_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT write client characteristic config failed.")
result.error(error)
}
}
}

View File

@ -1,42 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattDescriptor
import android.util.Log
import dev.yanshouwang.bluetooth_low_energy.pigeon.Messages as Pigeon
object MyGattDescriptorHostApi : Pigeon.GattDescriptorHostApi {
override fun free(id: String) {
Log.d(TAG, "free: $id")
unregister(id)
}
override fun read(id: String, result: Pigeon.Result<ByteArray>) {
Log.d(TAG, "read: $id")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
val descriptor = items[KEY_DESCRIPTOR] as BluetoothGattDescriptor
val succeed = gatt.readDescriptor(descriptor)
if (succeed) {
instances["$id/$KEY_READ_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT read descriptor failed.")
result.error(error)
}
}
override fun write(id: String, value: ByteArray, result: Pigeon.Result<Void>) {
Log.d(TAG, "write: $id, $value")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
val descriptor = items[KEY_DESCRIPTOR] as BluetoothGattDescriptor
descriptor.value = value
val succeed = gatt.writeDescriptor(descriptor)
if (succeed) {
instances["$id/$KEY_WRITE_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT write descriptor failed.")
result.error(error)
}
}
}

View File

@ -1,47 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattCharacteristic
import android.bluetooth.BluetoothGattService
import android.util.Log
import dev.yanshouwang.bluetooth_low_energy.pigeon.Messages as Pigeon
import dev.yanshouwang.bluetooth_low_energy.proto.gattCharacteristic
import dev.yanshouwang.bluetooth_low_energy.proto.uUID
object MyGattServiceHostApi : Pigeon.GattServiceHostApi {
override fun free(id: String) {
Log.d(TAG, "free: $id")
unregister(id)
}
override fun discoverCharacteristics(id: String, result: Pigeon.Result<MutableList<ByteArray>>) {
Log.d(TAG, "discoverCharacteristics: $id")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
val service = items[KEY_SERVICE] as BluetoothGattService
val characteristicValues = mutableListOf<ByteArray>()
for (characteristic in service.characteristics) {
val characteristicValue = registerCharacteristic(gatt, characteristic)
characteristicValues.add(characteristicValue)
}
result.success(characteristicValues)
}
private fun registerCharacteristic(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic): ByteArray {
val id = characteristic.hashCode().toString()
val items = register(id)
items[KEY_GATT] = gatt
items[KEY_CHARACTERISTIC] = characteristic
return gattCharacteristic {
this.id = id
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()
}
}

View File

@ -1,63 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.BluetoothDevice
import android.bluetooth.BluetoothGatt
import android.os.Build
import android.util.Log
import dev.yanshouwang.bluetooth_low_energy.pigeon.Messages as Pigeon
object MyPeripheralHostApi : Pigeon.PeripheralHostApi {
override fun free(id: String) {
Log.d(TAG, "free: $id")
unregister(id)
}
override fun connect(id: String, result: Pigeon.Result<Void>) {
Log.d(TAG, "connect: $id")
val items = instances[id] as MutableMap<String, Any>
val device = items[KEY_DEVICE] as BluetoothDevice
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[KEY_GATT] = gatt
instances["$id/$KEY_CONNECT_RESULT"] = result
}
override fun disconnect(id: String, result: Pigeon.Result<Void>) {
Log.d(TAG, "disconnect: $id")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
gatt.disconnect()
instances["$id/$KEY_DISCONNECT_RESULT"] = result
}
override fun requestMtu(id: String, result: Pigeon.Result<Long>) {
Log.d(TAG, "requestMtu: $id")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
val succeed = gatt.requestMtu(512)
if (succeed) {
instances["$id/$KEY_REQUEST_MTU_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT request MTU failed.")
result.error(error)
}
}
override fun discoverServices(id: String, result: Pigeon.Result<MutableList<ByteArray>>) {
Log.d(TAG, "discoverServices: $id")
val items = instances[id] as MutableMap<String, Any>
val gatt = items[KEY_GATT] as BluetoothGatt
val succeed = gatt.discoverServices()
if (succeed) {
instances["$id/$KEY_DISCOVER_SERVICES_RESULT"] = result
} else {
val error = BluetoothLowEnergyException("GATT discover services failed.")
result.error(error)
}
}
}

View File

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

View File

@ -1,92 +0,0 @@
package dev.yanshouwang.bluetooth_low_energy
import android.bluetooth.le.ScanCallback
import android.bluetooth.le.ScanResult
import android.os.Build
import android.util.Log
import com.google.protobuf.ByteString
import dev.yanshouwang.bluetooth_low_energy.proto.*
object MyScanCallback : ScanCallback() {
const val DATA_TYPE_MANUFACTURER_SPECIFIC_DATA = 0xff
override fun onScanFailed(errorCode: Int) {
super.onScanFailed(errorCode)
Log.d(TAG, "onScanFailed: $errorCode")
val error = BluetoothLowEnergyException("Start scan failed with code: $errorCode")
instances[KEY_START_SCAN_ERROR] = error
}
override fun onScanResult(callbackType: Int, result: ScanResult) {
super.onScanResult(callbackType, result)
Log.d(TAG, "onScanResult: $callbackType, $result")
onScanned(result)
}
override fun onBatchScanResults(results: MutableList<ScanResult>) {
super.onBatchScanResults(results)
Log.d(TAG, "onBatchScanResults: $results")
for (result in results) {
onScanned(result)
}
}
private fun onScanned(result: ScanResult): Unit {
val device = result.device
val id = device.hashCode().toString()
val items = register(id)
items[KEY_DEVICE] = device
val broadcastValue = broadcast {
this.peripheral = peripheral {
this.id = id
this.uuid = result.device.uuid
}
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.onScanned(broadcastValue) {}
}
}

View File

@ -1,395 +0,0 @@
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/messages.proto
package dev.yanshouwang.bluetooth_low_energy.proto;
@kotlin.jvm.JvmName("-initializebroadcast")
inline fun broadcast(block: dev.yanshouwang.bluetooth_low_energy.proto.BroadcastKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.Broadcast =
dev.yanshouwang.bluetooth_low_energy.proto.BroadcastKt.Dsl._create(dev.yanshouwang.bluetooth_low_energy.proto.Broadcast.newBuilder()).apply { block() }._build()
object BroadcastKt {
@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.Broadcast.Builder
) {
companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: dev.yanshouwang.bluetooth_low_energy.proto.Broadcast.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): dev.yanshouwang.bluetooth_low_energy.proto.Broadcast = _builder.build()
/**
* <code>.proto.Peripheral peripheral = 1;</code>
*/
var peripheral: dev.yanshouwang.bluetooth_low_energy.proto.Peripheral
@JvmName("getPeripheral")
get() = _builder.getPeripheral()
@JvmName("setPeripheral")
set(value) {
_builder.setPeripheral(value)
}
/**
* <code>.proto.Peripheral peripheral = 1;</code>
*/
fun clearPeripheral() {
_builder.clearPeripheral()
}
/**
* <code>.proto.Peripheral peripheral = 1;</code>
* @return Whether the peripheral field is set.
*/
fun hasPeripheral(): kotlin.Boolean {
return _builder.hasPeripheral()
}
/**
* <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.Broadcast.copy(block: dev.yanshouwang.bluetooth_low_energy.proto.BroadcastKt.Dsl.() -> kotlin.Unit): dev.yanshouwang.bluetooth_low_energy.proto.Broadcast =
dev.yanshouwang.bluetooth_low_energy.proto.BroadcastKt.Dsl._create(this.toBuilder()).apply { block() }._build()
val dev.yanshouwang.bluetooth_low_energy.proto.BroadcastOrBuilder.peripheralOrNull: dev.yanshouwang.bluetooth_low_energy.proto.Peripheral?
get() = if (hasPeripheral()) getPeripheral() else null

View File

@ -1,141 +0,0 @@
//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>string id = 1;</code>
*/
var id: kotlin.String
@JvmName("getId")
get() = _builder.getId()
@JvmName("setId")
set(value) {
_builder.setId(value)
}
/**
* <code>string 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

@ -1,73 +0,0 @@
//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>string id = 1;</code>
*/
var id: kotlin.String
@JvmName("getId")
get() = _builder.getId()
@JvmName("setId")
set(value) {
_builder.setId(value)
}
/**
* <code>string 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

@ -1,73 +0,0 @@
//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>string id = 1;</code>
*/
var id: kotlin.String
@JvmName("getId")
get() = _builder.getId()
@JvmName("setId")
set(value) {
_builder.setId(value)
}
/**
* <code>string 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

@ -1,73 +0,0 @@
//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>string id = 1;</code>
*/
var id: kotlin.String
@JvmName("getId")
get() = _builder.getId()
@JvmName("setId")
set(value) {
_builder.setId(value)
}
/**
* <code>string 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.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()
val dev.yanshouwang.bluetooth_low_energy.proto.PeripheralOrBuilder.uuidOrNull: dev.yanshouwang.bluetooth_low_energy.proto.UUID?
get() = if (hasUuid()) getUuid() else null

View File

@ -1,73 +0,0 @@
//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

@ -1,46 +0,0 @@
//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

@ -0,0 +1,42 @@
# 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.
version:
revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
channel: stable
project_type: plugin
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
- platform: android
create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
- platform: ios
create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
- platform: linux
create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
- platform: macos
create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
- platform: windows
create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
# 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 @@
## 2.0.0
- Rewrite the whole project with federated plugins.
- Support macOS and Linux.
## 1.1.0
- Fix the crash by onMtuChanged called multi-times on Android.

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 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
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,47 @@
# bluetooth_low_energy
A Flutter plugin for controlling the bluetooth low energy.
## Features
### CentralController
- [x] SetUp/TearDown central controller.
- [x] Get/Listen central state.
- [x] Start/Stop discovery.
- [x] Connect/Disconnect peripherals.
- [x] Discover GATT.
- [x] Get GATT services.
- [x] Get GATT characteristics.
- [x] Get GATT descriptors.
- [x] Read/Write/Notify GATT characteristics.
- [x] Read/Write GATT descriptors.
## Getting Started
Add `bluetooth_low_energy` as a [dependency in your pubspec.yaml file](https://flutter.dev/using-packages/).
```
dependencies:
bluetooth_low_energy: ^<latest-version>
```
Remember to call `await CentralController.setUp()` before use any apis of this plugin.
*Note*: Bluetooth Low Energy doesn't work on emulators, so use physical devices which has bluetooth features for development.
### Android
Make sure you have a `miniSdkVersion` with 21 or higher in your `android/app/build.gradle` file.
### iOS and macOS
According to Apple's [documents](https://developer.apple.com/documentation/corebluetooth/), you must include the [`NSBluetoothAlwaysUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothalwaysusagedescription) on or after iOS 13, and include the [`NSBluetoothPeripheralUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothperipheralusagedescription) key before iOS 13.
### Linux
Not tested yet, if you occured any problems, file an issue to let me know about it, i will fix it as soon as possible.
### Windows
Not implemented yet but maybe someday or someone can use the `win32` api to implement this plugin_interface or someday the flutter team support C# on windows platform or someday I am familiar with C++ language...

View File

@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@ -32,9 +32,6 @@ migrate_working_dir/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols

View File

@ -1,7 +1,8 @@
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)
}
}
@ -25,6 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
namespace "dev.yanshouwang.bluetooth_low_energy_example"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
@ -45,7 +47,8 @@ android {
// 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.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
// minSdkVersion flutter.minSdkVersion
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()

View File

@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.yanshouwang.bluetooth_low_energy_example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 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.

View File

@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.yanshouwang.bluetooth_low_energy_example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="bluetooth_low_energy_example"
android:name="${applicationName}"

View File

@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.yanshouwang.bluetooth_low_energy_example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 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.

View File

@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

View File

@ -1,6 +1,5 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

View File

@ -0,0 +1,23 @@
// This is a basic Flutter integration test.
//
// Since integration tests run in a full Flutter application, they can interact
// with the host side of a plugin implementation, unlike Dart unit tests.
//
// For more information about Flutter integration tests, please see
// https://docs.flutter.dev/cookbook/testing/integration/introduction
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:bluetooth_low_energy/bluetooth_low_energy.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('getPlatformVersion test', (WidgetTester tester) async {
final centralController = CentralController.instance;
await centralController.setUp();
// The version string depends on the host platform running the test, so
// just assert that some non-empty string is returned.
});
}

View File

@ -32,6 +32,9 @@ target 'Runner' do
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|

View File

@ -0,0 +1,28 @@
PODS:
- bluetooth_low_energy_ios (0.0.1):
- Flutter
- Flutter (1.0.0)
- integration_test (0.0.1):
- Flutter
DEPENDENCIES:
- bluetooth_low_energy_ios (from `.symlinks/plugins/bluetooth_low_energy_ios/ios`)
- Flutter (from `Flutter`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
EXTERNAL SOURCES:
bluetooth_low_energy_ios:
:path: ".symlinks/plugins/bluetooth_low_energy_ios/ios"
Flutter:
:path: Flutter
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
SPEC CHECKSUMS:
bluetooth_low_energy_ios: 91a6dff92249a98d885a4a8b024b80738a3124f2
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
integration_test: 13825b8a9334a850581300559b8839134b124670
PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189
COCOAPODS: 1.12.1

View File

@ -3,19 +3,31 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
369342A832F5F7F47DA4170A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98646AC7896A9C8175156D38 /* Pods_Runner.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
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 */; };
BC25F992B6ECFCC18D953308 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3248507C6DD52333A770C1CB /* Pods_Runner.framework */; };
A1695FB5D643C19FF42B7D1B /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 439B7B71AF91617DD56EEFF1 /* Pods_RunnerTests.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
proxyType = 1;
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
remoteInfo = Runner;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
@ -32,12 +44,17 @@
/* Begin PBXFileReference section */
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>"; };
3248507C6DD52333A770C1CB /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
38113858F1AB4328A9E0D621 /* 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>"; };
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>"; };
4088D13267D2EE25F7EE3CCF /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
439B7B71AF91617DD56EEFF1 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
67071827BD45B7E898C0774B /* 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>"; };
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>"; };
8F0034913C0134B13451F847 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -45,28 +62,50 @@
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>"; };
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>"; };
98646AC7896A9C8175156D38 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A31C0685DD53747D3B81FC1C /* 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>"; };
FAF9D3328591BF2DE56D8B53 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
4EEB0BF7ABB9FA0A8A0038DF /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A1695FB5D643C19FF42B7D1B /* Pods_RunnerTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BC25F992B6ECFCC18D953308 /* Pods_Runner.framework in Frameworks */,
369342A832F5F7F47DA4170A /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
2B77126ACFA0B323BF67EC4C /* Frameworks */ = {
331C8082294A63A400263BE5 /* RunnerTests */ = {
isa = PBXGroup;
children = (
3248507C6DD52333A770C1CB /* Pods_Runner.framework */,
331C807B294A618700263BE5 /* RunnerTests.swift */,
);
name = Frameworks;
path = RunnerTests;
sourceTree = "<group>";
};
822F134A747E09F3777D7DEA /* Pods */ = {
isa = PBXGroup;
children = (
67071827BD45B7E898C0774B /* Pods-Runner.debug.xcconfig */,
38113858F1AB4328A9E0D621 /* Pods-Runner.release.xcconfig */,
A31C0685DD53747D3B81FC1C /* Pods-Runner.profile.xcconfig */,
4088D13267D2EE25F7EE3CCF /* Pods-RunnerTests.debug.xcconfig */,
8F0034913C0134B13451F847 /* Pods-RunnerTests.release.xcconfig */,
FAF9D3328591BF2DE56D8B53 /* Pods-RunnerTests.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
@ -86,8 +125,9 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
F7511A57B6D81C59C9E0353E /* Pods */,
2B77126ACFA0B323BF67EC4C /* Frameworks */,
331C8082294A63A400263BE5 /* RunnerTests */,
822F134A747E09F3777D7DEA /* Pods */,
C80FCE1738A3643721B199AA /* Frameworks */,
);
sourceTree = "<group>";
};
@ -95,6 +135,7 @@
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@ -114,31 +155,49 @@
path = Runner;
sourceTree = "<group>";
};
F7511A57B6D81C59C9E0353E /* Pods */ = {
C80FCE1738A3643721B199AA /* Frameworks */ = {
isa = PBXGroup;
children = (
AEA309A3A59074B58910681F /* Pods-Runner.debug.xcconfig */,
C3AC24B274EC26E645389946 /* Pods-Runner.release.xcconfig */,
5CB2CF9D872B54AC77EFD5AD /* Pods-Runner.profile.xcconfig */,
98646AC7896A9C8175156D38 /* Pods_Runner.framework */,
439B7B71AF91617DD56EEFF1 /* Pods_RunnerTests.framework */,
);
path = Pods;
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
331C8080294A63A400263BE5 /* RunnerTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
buildPhases = (
F833496E53FDE3C2844AFA53 /* [CP] Check Pods Manifest.lock */,
331C807D294A63A400263BE5 /* Sources */,
331C807F294A63A400263BE5 /* Resources */,
4EEB0BF7ABB9FA0A8A0038DF /* Frameworks */,
);
buildRules = (
);
dependencies = (
331C8086294A63A400263BE5 /* PBXTargetDependency */,
);
name = RunnerTests;
productName = RunnerTests;
productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
224727E4C00C24BC3CD4292A /* [CP] Check Pods Manifest.lock */,
1DA3D512A09A37D587233A2B /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
DCBB4C37F33FFC666159F299 /* [CP] Embed Pods Frameworks */,
6130D1869ECFA87E05987AFE /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@ -158,6 +217,10 @@
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
CreatedOnToolsVersion = 14.0;
TestTargetID = 97C146ED1CF9000F007C117D;
};
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
@ -178,11 +241,19 @@
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
331C8080294A63A400263BE5 /* RunnerTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
331C807F294A63A400263BE5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@ -197,7 +268,7 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
224727E4C00C24BC3CD4292A /* [CP] Check Pods Manifest.lock */ = {
1DA3D512A09A37D587233A2B /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@ -221,10 +292,12 @@
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@ -233,21 +306,7 @@
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;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
DCBB4C37F33FFC666159F299 /* [CP] Embed Pods Frameworks */ = {
6130D1869ECFA87E05987AFE /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@ -264,9 +323,54 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
F833496E53FDE3C2844AFA53 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
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;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
331C807D294A63A400263BE5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -278,6 +382,14 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
331C8086294A63A400263BE5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 97C146ED1CF9000F007C117D /* Runner */;
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
@ -370,6 +482,56 @@
};
name = Profile;
};
331C8088294A63A400263BE5 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 4088D13267D2EE25F7EE3CCF /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.yanshouwang.bluetoothLowEnergyExample.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
};
name = Debug;
};
331C8089294A63A400263BE5 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8F0034913C0134B13451F847 /* Pods-RunnerTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.yanshouwang.bluetoothLowEnergyExample.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
};
name = Release;
};
331C808A294A63A400263BE5 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FAF9D3328591BF2DE56D8B53 /* Pods-RunnerTests.profile.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.yanshouwang.bluetoothLowEnergyExample.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -525,6 +687,16 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
331C8088294A63A400263BE5 /* Debug */,
331C8089294A63A400263BE5 /* Release */,
331C808A294A63A400263BE5 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@ -37,6 +37,17 @@
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "331C8080294A63A400263BE5"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

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