Still in progress
parent
be294ae264
commit
c1751c05db
@ -0,0 +1,235 @@
|
||||
package com.cloud.diplomaticquarterapp.smart_ring_2301
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.annotation.TargetApi
|
||||
import android.app.Service
|
||||
import android.bluetooth.BluetoothAdapter
|
||||
import android.bluetooth.BluetoothManager
|
||||
import android.bluetooth.le.ScanCallback
|
||||
import android.bluetooth.le.ScanResult
|
||||
import android.bluetooth.le.ScanSettings
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.ServiceConnection
|
||||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import android.text.TextUtils
|
||||
import com.jstyle.blesdk2301.callback.BleConnectionListener
|
||||
import com.jstyle.blesdk2301.callback.OnScanResults
|
||||
import com.jstyle.blesdk2301.model.Device
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* 蓝牙管理类 Bluetooth management class
|
||||
*/
|
||||
@SuppressLint("MissingPermission")
|
||||
class BleManager private constructor(var context: Context) {
|
||||
private var address: String? = null
|
||||
private var bleService: BleService? = null
|
||||
private val serviceConnection: ServiceConnection = object : ServiceConnection {
|
||||
override fun onServiceDisconnected(name: ComponentName) { // TODO Auto-generated method stub
|
||||
bleService = null
|
||||
}
|
||||
|
||||
override fun onServiceConnected(name: ComponentName, service: IBinder) {
|
||||
bleService = (service as BleService.LocalBinder).service
|
||||
if (!TextUtils.isEmpty(address)) {
|
||||
bleService!!.initBluetoothDevice(address, context, NeedReconnect1, bleConnectionListener1)
|
||||
}
|
||||
}
|
||||
}
|
||||
private var serviceIntent: Intent? = null
|
||||
var bluetoothAdapter: BluetoothAdapter?
|
||||
val isBleEnable: Boolean
|
||||
get() = bluetoothAdapter!!.enable()
|
||||
|
||||
/**
|
||||
* 连接蓝牙设备
|
||||
* Connect Bluetooth device
|
||||
*
|
||||
* @param address
|
||||
*/
|
||||
protected var NeedReconnect1 = true
|
||||
protected var bleConnectionListener1: BleConnectionListener? = null
|
||||
fun connectDevice(address: String?, NeedReconnect: Boolean, bleConnectionListener: BleConnectionListener?) {
|
||||
NeedReconnect1 = NeedReconnect
|
||||
bleConnectionListener1 = bleConnectionListener
|
||||
if (!bluetoothAdapter!!.isEnabled || TextUtils.isEmpty(address) || isConnected) return
|
||||
if (bleService == null) {
|
||||
this.address = address
|
||||
} else {
|
||||
bleService!!.initBluetoothDevice(address, context, NeedReconnect, bleConnectionListener)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭蓝牙服务通知
|
||||
* Turn off Bluetooth service notification
|
||||
*/
|
||||
fun enableNotifaction() {
|
||||
if (bleService == null) return
|
||||
bleService!!.setCharacteristicNotification(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入指令到蓝牙设备
|
||||
* Write command to Bluetooth device
|
||||
*/
|
||||
fun writeValue(value: ByteArray?) {
|
||||
if (bleService == null || instance == null) return
|
||||
bleService!!.writeValue(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* 多条指令同时添加后发送到设备
|
||||
* Multiple instructions are added at the same time and sent to the device
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
fun offerValue(data: ByteArray?) {
|
||||
if (bleService == null) return
|
||||
if (data != null) {
|
||||
bleService!!.offerValue(data)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入指令到蓝牙设备
|
||||
* Write command to Bluetooth device
|
||||
*/
|
||||
fun writeValue() {
|
||||
if (bleService == null) return
|
||||
bleService!!.nextQueue()
|
||||
}
|
||||
|
||||
/**
|
||||
* 断开设备 Disconnect the device
|
||||
*/
|
||||
fun disconnectDevice() {
|
||||
if (bleService == null) return
|
||||
bleService!!.disconnect()
|
||||
}
|
||||
|
||||
val isConnected: Boolean
|
||||
/**
|
||||
* 查询设备是否已经连接
|
||||
* Query whether the device is connected
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
get() = if (bleService == null) false else bleService!!.isConnected
|
||||
|
||||
/**
|
||||
* 取消扫描设备
|
||||
* Cancel scanning device
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
fun StopDeviceScan() {
|
||||
isinScan = false
|
||||
if (null != bluetoothAdapter && null != bluetoothAdapter!!.bluetoothLeScanner) {
|
||||
bluetoothAdapter!!.bluetoothLeScanner.stopScan(scanCallback)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫描蓝牙设备,用于开始绑定设备
|
||||
* Scan Bluetooth device to start binding device
|
||||
*/
|
||||
private var DevicesName: Array<String>? = null
|
||||
private var onScanResult: OnScanResults? = null
|
||||
private var isinScan = false
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
fun DeviceScanResults(Devicesname: Array<String>, onScanResults: OnScanResults) {
|
||||
if (!isinScan && instance!!.isBleEnable) { //如果蓝牙开关是开启的就进行扫描
|
||||
isinScan = true
|
||||
DevicesName = Devicesname
|
||||
onScanResult = onScanResults
|
||||
//返回已配对设备
|
||||
//获得已配对的远程蓝牙设备的集合
|
||||
val devices = bluetoothAdapter!!.bondedDevices
|
||||
if (devices.size > 0) {
|
||||
for (bluetoothDevice in devices) {
|
||||
if (Canctians(bluetoothDevice.name.lowercase(Locale.getDefault()))) {
|
||||
val device = Device()
|
||||
device.bluetoothDevice = bluetoothDevice
|
||||
device.isIsconted = false
|
||||
device.isPaired = true
|
||||
device.isIsdfu = bluetoothDevice.name.lowercase(Locale.getDefault()).contains("dfu")
|
||||
device.name = bluetoothDevice.name
|
||||
device.mac = bluetoothDevice.address
|
||||
onScanResult!!.Success(device)
|
||||
}
|
||||
}
|
||||
}
|
||||
bluetoothAdapter!!.bluetoothLeScanner.startScan(null, ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build(), scanCallback)
|
||||
}
|
||||
}
|
||||
|
||||
private val scanCallback: ScanCallback = object : ScanCallback() {
|
||||
override fun onScanResult(callbackType: Int, result: ScanResult) {
|
||||
super.onScanResult(callbackType, result)
|
||||
val deviceName = result.device.name
|
||||
if (isinScan && !TextUtils.isEmpty(deviceName) && Canctians(deviceName.lowercase(Locale.getDefault()).trim { it <= ' ' })) {
|
||||
val device = Device()
|
||||
device.bluetoothDevice = result.device
|
||||
device.isIsconted = false
|
||||
device.isPaired = false
|
||||
device.isIsdfu = deviceName.lowercase(Locale.getDefault()).contains("dfu")
|
||||
device.name = result.device.name
|
||||
device.mac = result.device.address
|
||||
device.riss = result.rssi
|
||||
onScanResult!!.Success(device)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBatchScanResults(results: List<ScanResult>) {
|
||||
super.onBatchScanResults(results)
|
||||
}
|
||||
|
||||
override fun onScanFailed(errorCode: Int) {
|
||||
super.onScanFailed(errorCode)
|
||||
onScanResult!!.Fail(errorCode)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
if (serviceIntent == null) {
|
||||
serviceIntent = Intent(context, BleService::class.java)
|
||||
context.bindService(serviceIntent, serviceConnection, Service.BIND_AUTO_CREATE)
|
||||
}
|
||||
val bluetoothManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
|
||||
bluetoothAdapter = bluetoothManager.adapter
|
||||
}
|
||||
|
||||
private fun Canctians(name: String): Boolean {
|
||||
var catian = false
|
||||
if (null == DevicesName || DevicesName!!.size == 0) {
|
||||
return false
|
||||
} else {
|
||||
for (devicesname in DevicesName!!) {
|
||||
if (name.lowercase(Locale.getDefault()).contains(devicesname.lowercase(Locale.getDefault()))) {
|
||||
catian = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return catian
|
||||
}
|
||||
|
||||
companion object {
|
||||
var instance: BleManager? = null
|
||||
private set
|
||||
|
||||
fun init(context: Context) {
|
||||
if (instance != null) {
|
||||
return
|
||||
}
|
||||
synchronized(BleManager::class.java) {
|
||||
if (instance == null) {
|
||||
instance = BleManager(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,11 @@
|
||||
package com.cloud.diplomaticquarterapp.smart_ring_2301.Util
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/4/11.
|
||||
*/
|
||||
class BleData {
|
||||
|
||||
var value: ByteArray? = null
|
||||
var action: String? = null
|
||||
var data: String? = null
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
package com.cloud.diplomaticquarterapp.smart_ring_2301.Util
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.ScheduledExecutorService
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* 计时器
|
||||
*/
|
||||
class CustomCountDownTimer(
|
||||
//Millis since epoch when alarm should stop.
|
||||
private var millisInFuture: Long, countDownInterval: Long,
|
||||
tickListener: TimerTickListener
|
||||
) {
|
||||
//thread on which the callbacks will be called
|
||||
private val mainThreadHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
//listener interface which is to be implemented by the users of the count down timer
|
||||
interface TimerTickListener {
|
||||
/**
|
||||
* Callback on each tick
|
||||
*
|
||||
* @param millisLeft time left in millisec for the timer to shutdown
|
||||
*/
|
||||
fun onTick(millisLeft: Long)
|
||||
|
||||
/**
|
||||
* Callback to be invokded when timer's time finishes
|
||||
*/
|
||||
fun onFinish()
|
||||
|
||||
/**
|
||||
* Callback to be invokded when timer is canceled
|
||||
*/
|
||||
fun onCancel()
|
||||
}
|
||||
|
||||
/**
|
||||
* Inner class which delegates the events to callbacks provided in the TimerTickListener
|
||||
*/
|
||||
private inner class TimerRunnable : Runnable {
|
||||
override fun run() {
|
||||
if (isCancelled) {
|
||||
scheduler.shutdown()
|
||||
mainThreadHandler.post { tickListener.onCancel() }
|
||||
} else if (isPaused) {
|
||||
} else {
|
||||
stopTimeInFuture = stopTimeInFuture - countdownInterval
|
||||
mainThreadHandler.post(object : Runnable {
|
||||
val millisLeft = stopTimeInFuture
|
||||
override fun run() {
|
||||
if (millisLeft <= 0) {
|
||||
tickListener.onFinish()
|
||||
scheduler.shutdown()
|
||||
} else {
|
||||
tickListener.onTick(millisLeft)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//The interval in millis that the user receives callbacks
|
||||
private val countdownInterval: Long
|
||||
|
||||
//the time at which timer is to stop
|
||||
private var stopTimeInFuture: Long
|
||||
|
||||
//boolean representing if the timer was cancelled
|
||||
var isCancelled = false
|
||||
|
||||
//boolean representing if the timer was paused
|
||||
private var isPaused = false
|
||||
|
||||
//listener which listens to the timer events
|
||||
private val tickListener: TimerTickListener
|
||||
|
||||
//scheduler which provides the thread to create timer
|
||||
private val scheduler: ScheduledExecutorService
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param millisInFuture time in millisec for which timer is to run
|
||||
* @param countDownInterval interval frequency in millisec at which the callback will be invoked
|
||||
* @param tickListener implementation of TimerTickListener which provides callbacks code
|
||||
*/
|
||||
init {
|
||||
stopTimeInFuture = millisInFuture
|
||||
countdownInterval = countDownInterval
|
||||
this.tickListener = tickListener
|
||||
scheduler = Executors.newSingleThreadScheduledExecutor()
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the countdown.
|
||||
*/
|
||||
@Synchronized
|
||||
fun start() {
|
||||
isCancelled = false
|
||||
isPaused = false
|
||||
scheduler.scheduleWithFixedDelay(
|
||||
TimerRunnable(), countdownInterval, countdownInterval,
|
||||
TimeUnit.MILLISECONDS
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels the countdown timer
|
||||
*/
|
||||
@Synchronized
|
||||
fun cancel() {
|
||||
isCancelled = true
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun pause() {
|
||||
isPaused = true
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun resume() {
|
||||
isPaused = false
|
||||
}
|
||||
|
||||
fun extendTime(delta: Long) {
|
||||
stopTimeInFuture = stopTimeInFuture + delta
|
||||
millisInFuture = millisInFuture + delta
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "CustomCountDownTimer"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,248 @@
|
||||
package com.cloud.diplomaticquarterapp.smart_ring_2301.Util
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.bluetooth.BluetoothDevice
|
||||
import android.content.ContentResolver
|
||||
import android.content.ContentUris
|
||||
import android.content.Context
|
||||
import android.database.Cursor
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.provider.DocumentsContract
|
||||
import android.provider.MediaStore
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import java.io.UnsupportedEncodingException
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/4/6.
|
||||
*/
|
||||
object ResolveData {
|
||||
private const val TAG = "ResolveData"
|
||||
private const val SHORTENED_LOCAL_NAME = 0x08
|
||||
private const val COMPLETE_LOCAL_NAME = 0x09
|
||||
private const val oneMinMillis = 60 * 1000L
|
||||
var startString = " 12:00:00"
|
||||
fun getBcd(value: String): Int {
|
||||
return value.toInt(16)
|
||||
}
|
||||
|
||||
fun decodeDeviceName(data: ByteArray): String? {
|
||||
var name: String? = null
|
||||
var fieldLength: Int
|
||||
var fieldName: Int
|
||||
val packetLength = data.size
|
||||
var index = 0
|
||||
while (index < packetLength) {
|
||||
fieldLength = data[index].toInt()
|
||||
if (fieldLength <= 0) break
|
||||
fieldName = data[++index].toInt()
|
||||
if (fieldName == COMPLETE_LOCAL_NAME
|
||||
|| fieldName == SHORTENED_LOCAL_NAME
|
||||
) {
|
||||
name = decodeLocalName(data, index + 1, fieldLength - 1)
|
||||
break
|
||||
}
|
||||
index += fieldLength - 1
|
||||
index++
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@JvmStatic
|
||||
fun decodeDeviceName(bluetoothDevice: BluetoothDevice, data: ByteArray): String? {
|
||||
var name = bluetoothDevice.name
|
||||
if (!TextUtils.isEmpty(name)) return name
|
||||
var fieldLength: Int
|
||||
var fieldName: Int
|
||||
val packetLength = data.size
|
||||
var index = 0
|
||||
while (index < packetLength) {
|
||||
fieldLength = data[index].toInt()
|
||||
if (fieldLength <= 0) break
|
||||
fieldName = data[++index].toInt()
|
||||
if (fieldName == COMPLETE_LOCAL_NAME
|
||||
|| fieldName == SHORTENED_LOCAL_NAME
|
||||
) {
|
||||
name = decodeLocalName(data, index + 1, fieldLength - 1)
|
||||
break
|
||||
}
|
||||
index += fieldLength - 1
|
||||
index++
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the local name
|
||||
*/
|
||||
fun decodeLocalName(
|
||||
data: ByteArray?, start: Int,
|
||||
length: Int
|
||||
): String? {
|
||||
return try {
|
||||
kotlin.String()
|
||||
} catch (e: UnsupportedEncodingException) {
|
||||
Log.e(
|
||||
"scan", "Unable to convert the complete local name to UTF-8",
|
||||
e
|
||||
)
|
||||
null
|
||||
} catch (e: IndexOutOfBoundsException) {
|
||||
Log.e("scan", "Error when reading complete local name", e)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转十六进制字符串
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@JvmStatic
|
||||
fun byte2Hex(data: ByteArray?): String {
|
||||
if (data != null && data.size > 0) {
|
||||
val sb = StringBuilder(data.size)
|
||||
for (tmp in data) {
|
||||
sb.append(String.format("%02X ", tmp))
|
||||
}
|
||||
return sb.toString()
|
||||
}
|
||||
return "no data"
|
||||
}
|
||||
|
||||
fun getRealFilePath(context: Context, uri: Uri?): String? {
|
||||
if (null == uri) return null
|
||||
val scheme = uri.scheme
|
||||
var data: String? = null
|
||||
if (scheme == null) data = uri.path else if (ContentResolver.SCHEME_FILE == scheme) {
|
||||
data = uri.path
|
||||
} else if (ContentResolver.SCHEME_CONTENT == scheme) {
|
||||
val cursor = context.contentResolver.query(uri, arrayOf(MediaStore.Images.ImageColumns.DATA), null, null, null)
|
||||
if (null != cursor) {
|
||||
if (cursor.moveToFirst()) {
|
||||
val index = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA)
|
||||
if (index > -1) {
|
||||
data = cursor.getString(index)
|
||||
}
|
||||
}
|
||||
cursor.close()
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
/**
|
||||
* 专为Android4.4设计的从Uri获取文件绝对路径
|
||||
*/
|
||||
fun getPath(context: Context, uri: Uri): String? {
|
||||
|
||||
|
||||
// DocumentProvider
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && DocumentsContract.isDocumentUri(context, uri)) {
|
||||
// ExternalStorageProvider
|
||||
if (isExternalStorageDocument(uri)) {
|
||||
val docId = DocumentsContract.getDocumentId(uri)
|
||||
val split = docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||
val type = split[0]
|
||||
if ("primary".equals(type, ignoreCase = true)) {
|
||||
return Environment.getExternalStorageDirectory().toString() + "/" + split[1]
|
||||
}
|
||||
|
||||
// TODO handle non-primary volumes
|
||||
} else if (isDownloadsDocument(uri)) {
|
||||
val id = DocumentsContract.getDocumentId(uri)
|
||||
val contentUri = ContentUris.withAppendedId(
|
||||
Uri.parse("content://downloads/public_downloads"), java.lang.Long.valueOf(id)
|
||||
)
|
||||
return getDataColumn(context, contentUri, null, null)
|
||||
} else if (isMediaDocument(uri)) {
|
||||
val docId = DocumentsContract.getDocumentId(uri)
|
||||
val split = docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||
val type = split[0]
|
||||
var contentUri: Uri? = null
|
||||
if ("image" == type) {
|
||||
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
|
||||
} else if ("video" == type) {
|
||||
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
|
||||
} else if ("audio" == type) {
|
||||
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
|
||||
}
|
||||
val selection = "_id=?"
|
||||
val selectionArgs = arrayOf(split[1])
|
||||
return getDataColumn(context, contentUri, selection, selectionArgs)
|
||||
}
|
||||
} else if ("content".equals(uri.scheme, ignoreCase = true)) {
|
||||
return getDataColumn(context, uri, null, null)
|
||||
} else if ("file".equals(uri.scheme, ignoreCase = true)) {
|
||||
return uri.path
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the data column for this Uri. This is useful for
|
||||
* MediaStore Uris, and other file-based ContentProviders.
|
||||
*
|
||||
* @param context
|
||||
* The context.
|
||||
* @param uri
|
||||
* The Uri to query.
|
||||
* @param selection
|
||||
* (Optional) Filter used in the query.
|
||||
* @param selectionArgs
|
||||
* (Optional) Selection arguments used in the query.
|
||||
* @return The value of the _data column, which is typically a file path.
|
||||
*/
|
||||
fun getDataColumn(
|
||||
context: Context, uri: Uri?, selection: String?,
|
||||
selectionArgs: Array<String>?
|
||||
): String? {
|
||||
var cursor: Cursor? = null
|
||||
val column = "_data"
|
||||
val projection = arrayOf(column)
|
||||
try {
|
||||
cursor = context.contentResolver.query(
|
||||
uri!!, projection, selection, selectionArgs,
|
||||
null
|
||||
)
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
val column_index = cursor.getColumnIndexOrThrow(column)
|
||||
return cursor.getString(column_index)
|
||||
}
|
||||
} finally {
|
||||
cursor?.close()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri
|
||||
* The Uri to check.
|
||||
* @return Whether the Uri authority is ExternalStorageProvider.
|
||||
*/
|
||||
fun isExternalStorageDocument(uri: Uri): Boolean {
|
||||
return "com.android.externalstorage.documents" == uri.authority
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri
|
||||
* The Uri to check.
|
||||
* @return Whether the Uri authority is DownloadsProvider.
|
||||
*/
|
||||
fun isDownloadsDocument(uri: Uri): Boolean {
|
||||
return "com.android.providers.downloads.documents" == uri.authority
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri
|
||||
* The Uri to check.
|
||||
* @return Whether the Uri authority is MediaProvider.
|
||||
*/
|
||||
fun isMediaDocument(uri: Uri): Boolean {
|
||||
return "com.android.providers.media.documents" == uri.authority
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.cloud.diplomaticquarterapp.smart_ring_2301.Util
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import io.reactivex.rxjava3.processors.FlowableProcessor
|
||||
import io.reactivex.rxjava3.processors.PublishProcessor
|
||||
import io.reactivex.rxjava3.subjects.PublishSubject
|
||||
import io.reactivex.rxjava3.subjects.Subject
|
||||
|
||||
|
||||
/**
|
||||
* Created by zhuge on 2017/1/19 0019.
|
||||
*/
|
||||
class RxBus private constructor() {
|
||||
private val bus: Subject<Any>
|
||||
private val mBus: FlowableProcessor<Any>
|
||||
|
||||
init {
|
||||
mBus = PublishProcessor.create<Any>().toSerialized()
|
||||
bus = PublishSubject.create<Any>().toSerialized()
|
||||
}
|
||||
|
||||
fun post(`object`: Any) {
|
||||
bus.onNext(`object`)
|
||||
}
|
||||
|
||||
fun <T : Any> toObservable(eventType: Class<T>): Observable<T> {
|
||||
return bus.ofType(eventType)
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
val instance = RxBus()
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.cloud.diplomaticquarterapp.smart_ring_2301.Util
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.core.ObservableTransformer
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/4/26.
|
||||
*/
|
||||
object SchedulersTransformer {
|
||||
private const val TAG = "SchedulersTransformer"
|
||||
fun <T : Any> io2MainObservable(): ObservableTransformer<T, T> {
|
||||
return ObservableTransformer { upstream -> upstream.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) }
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.cloud.diplomaticquarterapp.smart_ring_2301.Util
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
|
||||
object SharedPreferenceUtils {
|
||||
const val KEY_REMIND_PSD = "REMIND_PSD"
|
||||
const val KEY_account_type = "KEY_account_type"
|
||||
const val KEY_countryCode = "KEY_countryCode"
|
||||
const val KEY_TimeZone = "KEY_TimeZone"
|
||||
const val KEY_DFU_ADDRESS = "KEY_DFU_ADDRESS"
|
||||
const val KEY_Exercise_Mode = "KEY_Exercise_Mode"
|
||||
const val KEY_Enable_ActivityClock = "KEY_Enable_ActivityClock"
|
||||
const val KEY_UNIT_WEIGHT = "KEY_UNIT_WEIGHT"
|
||||
const val KEY_UNIT_HEIGHT = "KEY_UNIT_HEIGHT"
|
||||
const val KEY_RES_FILEPATH = "KEY_RES_FILEPATH"
|
||||
const val KEY_Is_First = "KEY_Is_First"
|
||||
const val KEY_From_Login = "KEY_From_Login"
|
||||
const val KEY_PHONE = "PHONE"
|
||||
const val KEY_UID = "uid"
|
||||
const val KEY_PSD = "PSD"
|
||||
const val KEY_ADDRESS = "ADDRESS"
|
||||
const val KEY_Language = "Language"
|
||||
const val KEY_LOGIN = "lOGIN"
|
||||
const val KEY_NICKNAME = "nickname"
|
||||
private const val spName = "jstyle_sleep"
|
||||
const val KEY_AUTH_USERID = "KEY_AUTH_USERID"
|
||||
const val KEY_highHeart = "highHeart"
|
||||
const val KEY_highBrEATH = "highBrEATH"
|
||||
const val KEY_lowHeart = "lowHeart"
|
||||
const val KEY_lowBreath = "lowBreath"
|
||||
const val KEY_deviceName = "deviceName"
|
||||
const val KEY_PLAN_ON = "PLAN_ON"
|
||||
const val KEY_PLAN_first = "PLAN_first"
|
||||
const val KEY_Sleep_goal = "KEY_Sleep_goal"
|
||||
const val KEY_Step_goal = "KEY_Step_goal"
|
||||
const val KEY_deviceType = "KEY_deviceType"
|
||||
var sharedPreferences: SharedPreferences? = null
|
||||
private set
|
||||
const val DefaultCountryCode = "0086-"
|
||||
fun init(context: Context) {
|
||||
sharedPreferences = context.getSharedPreferences(spName, Activity.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
fun setSpBoolean(name: String?, bool: Boolean) {
|
||||
sharedPreferences!!.edit().putBoolean(name, bool).commit()
|
||||
}
|
||||
|
||||
fun getSpBoolean(name: String?): Boolean {
|
||||
return sharedPreferences!!.getBoolean(name, false)
|
||||
}
|
||||
|
||||
fun getBoolean(name: String?, defaultValue: Boolean): Boolean {
|
||||
return sharedPreferences!!.getBoolean(name, defaultValue)
|
||||
}
|
||||
|
||||
fun setSpString(name: String?, value: String?) {
|
||||
sharedPreferences!!.edit().putString(name, value).commit()
|
||||
}
|
||||
|
||||
fun getSpString(name: String?): String? {
|
||||
return getString(name, null)
|
||||
}
|
||||
|
||||
fun getString(name: String?, defaultValue: String?): String? {
|
||||
return sharedPreferences!!.getString(name, defaultValue)
|
||||
}
|
||||
|
||||
fun setSpInteger(name: String?, value: Int) {
|
||||
sharedPreferences!!.edit().putInt(name, value).commit()
|
||||
}
|
||||
|
||||
fun getInteger(name: String?, defaultValue: Int): Int {
|
||||
return sharedPreferences!!.getInt(name, defaultValue)
|
||||
}
|
||||
|
||||
fun getSpInteger(name: String?): Int {
|
||||
return getInteger(name, -1)
|
||||
}
|
||||
|
||||
fun setSpFloat(name: String?, value: Float) {
|
||||
sharedPreferences!!.edit().putFloat(name, value).commit()
|
||||
}
|
||||
|
||||
fun getSpFloat(name: String?): Float {
|
||||
return getFloat(name, 0.0f)
|
||||
}
|
||||
|
||||
fun getFloat(name: String?, defaultValue: Float): Float {
|
||||
return sharedPreferences!!.getFloat(name, defaultValue)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,10 +0,0 @@
|
||||
package com.jstyle.blesdk2301.callback;
|
||||
|
||||
public interface BleConnectionListener {
|
||||
void BleStatus(int status,int newState);//蓝牙4.0连接状态 Bluetooth 4.0 connection status
|
||||
void ConnectionSucceeded();//连接设备成功 Successfully connected the device
|
||||
void Connecting();//设备连接中 Device is connected
|
||||
void ConnectionFailed();//设备连接失败 Device connection failed
|
||||
void OnReconnect();//重新连接中 Reconnecting
|
||||
void BluetoothSwitchIsTurnedOff();//蓝牙开关被关闭 Bluetooth switch is turned off
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.jstyle.blesdk2301.callback
|
||||
|
||||
interface BleConnectionListener {
|
||||
fun BleStatus(status: Int, newState: Int) //蓝牙4.0连接状态 Bluetooth 4.0 connection status
|
||||
fun ConnectionSucceeded() //连接设备成功 Successfully connected the device
|
||||
fun Connecting() //设备连接中 Device is connected
|
||||
fun ConnectionFailed() //设备连接失败 Device connection failed
|
||||
fun OnReconnect() //重新连接中 Reconnecting
|
||||
fun BluetoothSwitchIsTurnedOff() //蓝牙开关被关闭 Bluetooth switch is turned off
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
package com.jstyle.blesdk2301.callback;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/4/10.
|
||||
*/
|
||||
|
||||
public interface DataListener2301 {
|
||||
void dataCallback(Map<String, Object> maps);
|
||||
void dataCallback(byte[] value);
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.jstyle.blesdk2301.callback
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/4/10.
|
||||
*/
|
||||
interface DataListener2301 {
|
||||
fun dataCallback(maps: Map<String?, Any?>?)
|
||||
fun dataCallback(value: ByteArray?)
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
package com.jstyle.blesdk2301.callback;
|
||||
|
||||
|
||||
import com.jstyle.blesdk2301.model.Device;
|
||||
|
||||
public interface OnScanResults {
|
||||
void Success(Device date);
|
||||
void Fail(int code);
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.jstyle.blesdk2301.callback
|
||||
|
||||
import com.jstyle.blesdk2301.model.Device
|
||||
|
||||
interface OnScanResults {
|
||||
fun Success(date: Device?)
|
||||
fun Fail(code: Int)
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
package com.jstyle.blesdk2301.cmdenum;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class YhDeviceData implements Serializable {
|
||||
int dataType;// is index
|
||||
String data="";//data object
|
||||
boolean dataEnd=false; //Is it over?
|
||||
|
||||
public boolean isDataEnd() {
|
||||
return dataEnd;
|
||||
}
|
||||
|
||||
public void setDataEnd(boolean dataEnd) {
|
||||
this.dataEnd = dataEnd;
|
||||
}
|
||||
|
||||
public int getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(int dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data==null?"":data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "YhDeviceData{" +
|
||||
"dataType=" + dataType +
|
||||
", data=" + data +
|
||||
", dataEnd=" + dataEnd +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.jstyle.blesdk2301.cmdenum
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class YhDeviceData : Serializable {
|
||||
var dataType = 0 // is index
|
||||
var data: String? = "" //data object
|
||||
var isDataEnd = false //Is it over?
|
||||
fun srgetDeviceData(): String {
|
||||
return if (data == null) "" else data!!
|
||||
}
|
||||
|
||||
fun srsetData(data: String?) {
|
||||
this.data = data
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "YhDeviceData{" +
|
||||
"dataType=" + dataType +
|
||||
", data=" + data +
|
||||
", dataEnd=" + isDataEnd +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@ -1,135 +0,0 @@
|
||||
package com.jstyle.blesdk2301.constant;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2020/4/9.
|
||||
*/
|
||||
|
||||
public class BleConst {
|
||||
public static final String GetDeviceTime="0";
|
||||
public static final String SetDeviceTime="1";
|
||||
public static final String GetPersonalInfo="2";
|
||||
public static final String SetPersonalInfo="3";
|
||||
public static final String GetDeviceInfo="4";
|
||||
public static final String SetDeviceInfo="5";//设置手环基本参数
|
||||
public static final String CMD_Set_Mac="6";
|
||||
public static final String GetStepGoal="7";
|
||||
public static final String SetStepGoal="8";
|
||||
public static final String GetDeviceBatteryLevel="9";
|
||||
public static final String GetDeviceMacAddress="10";
|
||||
public static final String GetDeviceVersion="11";
|
||||
public static final String CMD_Reset="12";
|
||||
public static final String CMD_MCUReset="13";
|
||||
public static final String SetMotorVibrationWithTimes ="14";
|
||||
public static final String GetDeviceName="15";
|
||||
public static final String GetAutomatic="16";
|
||||
public static final String SetAutomatic="17";
|
||||
public static final String GetAlarmClock="18";
|
||||
public static final String SetAlarmClockWithAllClock="19";
|
||||
public static final String Notify="20";
|
||||
public static final String GetSedentaryReminder="21";
|
||||
public static final String SetSedentaryReminder="22";
|
||||
public static final String RealTimeStep="23";
|
||||
public static final String GetTotalActivityData="24";
|
||||
public static final String GetDetailActivityData="25";
|
||||
public static final String GetDetailSleepData="26";
|
||||
public static final String GetDynamicHR="27";
|
||||
public static final String GetStaticHR="28";
|
||||
public static final String GetActivityModeData="29";
|
||||
public static final String EnterActivityMode="30";
|
||||
public static final String DeviceSendDataToAPP="31";
|
||||
public static final String BackHomeView="35";
|
||||
public static final String GetTempHistoryData="36";
|
||||
public static final String ECGDATA="37";
|
||||
public static final String EcgppGstatus="38";
|
||||
public static final String EcgppG="39";
|
||||
public static final String GPSControlCommand="40";
|
||||
public static final String Gps="41";//手环发送给app
|
||||
public static final String GetHRVData="42";
|
||||
public static final String CMD_Set_TemperatureCorrection="43";
|
||||
public static final String Weather="44";
|
||||
public static final String Braceletdial="45";
|
||||
public static final String Braceletdialok="46";
|
||||
public static final String SportMode="47";
|
||||
public static final String GetSportMode="48";
|
||||
public static final String CMD_Set_WorkOutReminder="49";
|
||||
public static final String CMD_Get_WorkOutReminder="50";
|
||||
public static final String ReadSerialNumber="51";
|
||||
public static final String ECG="53";
|
||||
public static final String Clear_Bracelet_data="54";
|
||||
public static final String Blood_oxygen="55";
|
||||
public static final String SocialdistanceGetting="56";
|
||||
public static final String SocialdistanceSetting="57";
|
||||
public static final String Sos="58";
|
||||
public static final String Temperature_history="59";
|
||||
public static final String SetDialinterface="60";
|
||||
public static final String HeartBeatpacket="61";
|
||||
public static final String GetAxillaryTemperatureDataWithMode="62";
|
||||
public static final String GetMAC="63";
|
||||
public static final String Getppg="64";
|
||||
public static final String CloseECGPPG="65";
|
||||
public static final String GetEcgPpgStatus="66";
|
||||
public static final String ECGdata="67";
|
||||
public static final String GetAutomaticSpo2Monitoring="68";
|
||||
public static final String SetSpo2="69";
|
||||
public static final String GEtSpo2="70";
|
||||
public static final String DeleteECGdata="71";
|
||||
public static final String DeleteHrv="72";
|
||||
public static final String MeasurementHrvCallback="73";
|
||||
public static final String MeasurementHeartCallback="74";
|
||||
public static final String MeasurementOxygenCallback="75";
|
||||
public static final String StopMeasurementHrvCallback="76";
|
||||
public static final String StopMeasurementHeartCallback="77";
|
||||
public static final String StopMeasurementOxygenCallback="78";
|
||||
public static final String ExitQRcode="79";
|
||||
public static final String EnterQRcode="80";
|
||||
public static final String QRcodebandBack="81";
|
||||
public static final String SportData="82";
|
||||
public static final String Delete_Obtain_The_data_of_manual_blood_oxygen_test="83";
|
||||
public static final String Delete_Blood_oxygen="84";
|
||||
public static final String Delete_GetTotalActivityData="85";
|
||||
public static final String Delete_AlarmClock="87";
|
||||
public static final String Delete_ActivityModeData="88";
|
||||
public static final String Delete_GetStaticHR="89";
|
||||
public static final String Delete_GetDynamicHR="90";
|
||||
public static final String deleteGetTemperature_historyDataWithMode="91";
|
||||
public static final String deleteGetAxillaryTemperatureDataWithMode="92";
|
||||
public static final String deleteGetDetailActivityDataWithMode="93";
|
||||
public static final String Delete_GetDetailSleepData="94";
|
||||
public static final String Enter_photo_mode="95";
|
||||
public static final String openRRInterval="96";
|
||||
public static final String closeRRInterval="97";
|
||||
public static final String realtimeRRIntervalData="98";
|
||||
public static final String realtimePPGData="99";
|
||||
public static final String realtimePPIData="100";
|
||||
|
||||
public static final String ppgWithMode="101";
|
||||
public static final String ppgStartSucessed="102";
|
||||
public static final String ppgStartFailed="103";
|
||||
public static final String ppgStop="104";
|
||||
public static final String ppgQuit="105";
|
||||
public static final String ppgMeasurementProgress="106";
|
||||
public static final String ppgResult="107";
|
||||
public static final String SetBloodpressure_calibration="108";
|
||||
public static final String GetBloodpressure_calibration="109";
|
||||
public static final String SetWomenHealth="110";
|
||||
public static final String GetWomenHealth="111";
|
||||
|
||||
public static final String SetPregnancyCycle="112";
|
||||
public static final String GetPregnancyCycle="113";
|
||||
public static final String Getpeisu="114";
|
||||
public static final String GetpeisuER="115";
|
||||
public static final String CMD_Set_Name="116";
|
||||
public static final String CMD_Get_Name="117";
|
||||
public static final String Blood_glucose_status="118";
|
||||
public static final String Blood_glucose_data="119";
|
||||
public static final String FindActivityMode="120";
|
||||
|
||||
|
||||
|
||||
public static final String FindMobilePhoneMode="FindMobilePhoneMode";
|
||||
public static final String RejectTelMode ="RejectTelMode";
|
||||
public static final String TelMode ="TelMode";
|
||||
public static final String ECGResult="ECGResult";
|
||||
public static final String ENTERECG="ENTERECG";
|
||||
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
package com.jstyle.blesdk2301.constant
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2020/4/9.
|
||||
*/
|
||||
object BleConst {
|
||||
const val GetDeviceTime = "0"
|
||||
const val SetDeviceTime = "1"
|
||||
const val GetPersonalInfo = "2"
|
||||
const val SetPersonalInfo = "3"
|
||||
const val GetDeviceInfo = "4"
|
||||
const val SetDeviceInfo = "5" //设置手环基本参数
|
||||
const val CMD_Set_Mac = "6"
|
||||
const val GetStepGoal = "7"
|
||||
const val SetStepGoal = "8"
|
||||
const val GetDeviceBatteryLevel = "9"
|
||||
const val GetDeviceMacAddress = "10"
|
||||
const val GetDeviceVersion = "11"
|
||||
const val CMD_Reset = "12"
|
||||
const val CMD_MCUReset = "13"
|
||||
const val SetMotorVibrationWithTimes = "14"
|
||||
const val GetDeviceName = "15"
|
||||
const val GetAutomatic = "16"
|
||||
const val SetAutomatic = "17"
|
||||
const val GetAlarmClock = "18"
|
||||
const val SetAlarmClockWithAllClock = "19"
|
||||
const val Notify = "20"
|
||||
const val GetSedentaryReminder = "21"
|
||||
const val SetSedentaryReminder = "22"
|
||||
const val RealTimeStep = "23"
|
||||
const val GetTotalActivityData = "24"
|
||||
const val GetDetailActivityData = "25"
|
||||
const val GetDetailSleepData = "26"
|
||||
const val GetDynamicHR = "27"
|
||||
const val GetStaticHR = "28"
|
||||
const val GetActivityModeData = "29"
|
||||
const val EnterActivityMode = "30"
|
||||
const val DeviceSendDataToAPP = "31"
|
||||
const val BackHomeView = "35"
|
||||
const val GetTempHistoryData = "36"
|
||||
const val ECGDATA = "37"
|
||||
const val EcgppGstatus = "38"
|
||||
const val EcgppG = "39"
|
||||
const val GPSControlCommand = "40"
|
||||
const val Gps = "41" //手环发送给app
|
||||
const val GetHRVData = "42"
|
||||
const val CMD_Set_TemperatureCorrection = "43"
|
||||
const val Weather = "44"
|
||||
const val Braceletdial = "45"
|
||||
const val Braceletdialok = "46"
|
||||
const val SportMode = "47"
|
||||
const val GetSportMode = "48"
|
||||
const val CMD_Set_WorkOutReminder = "49"
|
||||
const val CMD_Get_WorkOutReminder = "50"
|
||||
const val ReadSerialNumber = "51"
|
||||
const val ECG = "53"
|
||||
const val Clear_Bracelet_data = "54"
|
||||
const val Blood_oxygen = "55"
|
||||
const val SocialdistanceGetting = "56"
|
||||
const val SocialdistanceSetting = "57"
|
||||
const val Sos = "58"
|
||||
const val Temperature_history = "59"
|
||||
const val SetDialinterface = "60"
|
||||
const val HeartBeatpacket = "61"
|
||||
const val GetAxillaryTemperatureDataWithMode = "62"
|
||||
const val GetMAC = "63"
|
||||
const val Getppg = "64"
|
||||
const val CloseECGPPG = "65"
|
||||
const val GetEcgPpgStatus = "66"
|
||||
const val ECGdata = "67"
|
||||
const val GetAutomaticSpo2Monitoring = "68"
|
||||
const val SetSpo2 = "69"
|
||||
const val GEtSpo2 = "70"
|
||||
const val DeleteECGdata = "71"
|
||||
const val DeleteHrv = "72"
|
||||
const val MeasurementHrvCallback = "73"
|
||||
const val MeasurementHeartCallback = "74"
|
||||
const val MeasurementOxygenCallback = "75"
|
||||
const val StopMeasurementHrvCallback = "76"
|
||||
const val StopMeasurementHeartCallback = "77"
|
||||
const val StopMeasurementOxygenCallback = "78"
|
||||
const val ExitQRcode = "79"
|
||||
const val EnterQRcode = "80"
|
||||
const val QRcodebandBack = "81"
|
||||
const val SportData = "82"
|
||||
const val Delete_Obtain_The_data_of_manual_blood_oxygen_test = "83"
|
||||
const val Delete_Blood_oxygen = "84"
|
||||
const val Delete_GetTotalActivityData = "85"
|
||||
const val Delete_AlarmClock = "87"
|
||||
const val Delete_ActivityModeData = "88"
|
||||
const val Delete_GetStaticHR = "89"
|
||||
const val Delete_GetDynamicHR = "90"
|
||||
const val deleteGetTemperature_historyDataWithMode = "91"
|
||||
const val deleteGetAxillaryTemperatureDataWithMode = "92"
|
||||
const val deleteGetDetailActivityDataWithMode = "93"
|
||||
const val Delete_GetDetailSleepData = "94"
|
||||
const val Enter_photo_mode = "95"
|
||||
const val openRRInterval = "96"
|
||||
const val closeRRInterval = "97"
|
||||
const val realtimeRRIntervalData = "98"
|
||||
const val realtimePPGData = "99"
|
||||
const val realtimePPIData = "100"
|
||||
const val ppgWithMode = "101"
|
||||
const val ppgStartSucessed = "102"
|
||||
const val ppgStartFailed = "103"
|
||||
const val ppgStop = "104"
|
||||
const val ppgQuit = "105"
|
||||
const val ppgMeasurementProgress = "106"
|
||||
const val ppgResult = "107"
|
||||
const val SetBloodpressure_calibration = "108"
|
||||
const val GetBloodpressure_calibration = "109"
|
||||
const val SetWomenHealth = "110"
|
||||
const val GetWomenHealth = "111"
|
||||
const val SetPregnancyCycle = "112"
|
||||
const val GetPregnancyCycle = "113"
|
||||
const val Getpeisu = "114"
|
||||
const val GetpeisuER = "115"
|
||||
const val CMD_Set_Name = "116"
|
||||
const val CMD_Get_Name = "117"
|
||||
const val Blood_glucose_status = "118"
|
||||
const val Blood_glucose_data = "119"
|
||||
const val FindActivityMode = "120"
|
||||
const val FindMobilePhoneMode = "FindMobilePhoneMode"
|
||||
const val RejectTelMode = "RejectTelMode"
|
||||
const val TelMode = "TelMode"
|
||||
const val ECGResult = "ECGResult"
|
||||
const val ENTERECG = "ENTERECG"
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
package com.jstyle.blesdk2301.constant;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/17.
|
||||
*/
|
||||
|
||||
public class DeviceConst {
|
||||
public static final byte CMD_SET_TIME = (byte)0x01;
|
||||
public static final byte CMD_GET_TIME = (byte)0x41;
|
||||
public static final byte CMD_Set_UseInfo = (byte)0x02;
|
||||
public static final byte CMD_GET_USERINFO = (byte) 0x42;
|
||||
public static final byte CMD_Set_DeviceID = (byte)0x05;
|
||||
public static final byte CMD_Enable_Activity = (byte)0x09;//
|
||||
public static final byte CMD_Get_BatteryLevel = (byte)0x13;//
|
||||
public static final byte CMD_Get_Address = (byte)0x22;
|
||||
public static final byte CMD_Get_Version = (byte)0x27;
|
||||
public static final byte CMD_Reset = (byte)0x12;
|
||||
public static final byte CMD_Mcu_Reset = (byte)0x2e;
|
||||
public static final byte CMD_Set_Auto = (byte)0x2a;
|
||||
public static final byte CMD_Get_Auto = (byte)0x2b;
|
||||
public static final byte CMD_Get_TotalData = (byte)0x51;//
|
||||
public static final byte CMD_Get_DetailData = (byte)0x52;
|
||||
public static final byte CMD_Get_SleepData = (byte)0x53;
|
||||
public static final byte CMD_Get_HeartData = (byte)0x54;
|
||||
public static final byte CMD_Get_OnceHeartData = (byte)0x55;
|
||||
public static final byte CMD_Get_HrvTestData = (byte)0x56;//
|
||||
public static final byte ReadTempHisrory= (byte)0x62;
|
||||
public static final byte MeasurementWithType= (byte)0x28;
|
||||
public static final byte Oxygen_data= (byte)0x66;
|
||||
|
||||
public static final byte CMD_Start_EXERCISE = (byte)0x19;
|
||||
public static final byte CMD_heart_package= (byte)0x17;
|
||||
public static final byte CMD_HeartPackageFromDevice = (byte)0x18;//
|
||||
public static final byte CMD_Set_Name = (byte)0x3d;
|
||||
public static final byte CMD_Get_Name = (byte)0x3e;
|
||||
|
||||
public static final byte CMD_Get_SPORTData = (byte)0x5C;
|
||||
|
||||
public static final byte CMD_Get_Bloodsugar = (byte)0x78;
|
||||
public static final byte Bloodsugar_data=(byte)0x3a;//血糖数据
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.jstyle.blesdk2301.constant
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/17.
|
||||
*/
|
||||
object DeviceConst {
|
||||
const val CMD_SET_TIME = 0x01.toByte()
|
||||
const val CMD_GET_TIME = 0x41.toByte()
|
||||
const val CMD_Set_UseInfo = 0x02.toByte()
|
||||
const val CMD_GET_USERINFO = 0x42.toByte()
|
||||
const val CMD_Set_DeviceID = 0x05.toByte()
|
||||
const val CMD_Enable_Activity = 0x09.toByte() //
|
||||
const val CMD_Get_BatteryLevel = 0x13.toByte() //
|
||||
const val CMD_Get_Address = 0x22.toByte()
|
||||
const val CMD_Get_Version = 0x27.toByte()
|
||||
const val CMD_Reset = 0x12.toByte()
|
||||
const val CMD_Mcu_Reset = 0x2e.toByte()
|
||||
const val CMD_Set_Auto = 0x2a.toByte()
|
||||
const val CMD_Get_Auto = 0x2b.toByte()
|
||||
const val CMD_Get_TotalData = 0x51.toByte() //
|
||||
const val CMD_Get_DetailData = 0x52.toByte()
|
||||
const val CMD_Get_SleepData = 0x53.toByte()
|
||||
const val CMD_Get_HeartData = 0x54.toByte()
|
||||
const val CMD_Get_OnceHeartData = 0x55.toByte()
|
||||
const val CMD_Get_HrvTestData = 0x56.toByte() //
|
||||
const val ReadTempHisrory = 0x62.toByte()
|
||||
const val MeasurementWithType = 0x28.toByte()
|
||||
const val Oxygen_data = 0x66.toByte()
|
||||
const val CMD_Start_EXERCISE = 0x19.toByte()
|
||||
const val CMD_heart_package = 0x17.toByte()
|
||||
const val CMD_HeartPackageFromDevice = 0x18.toByte() //
|
||||
const val CMD_Set_Name = 0x3d.toByte()
|
||||
const val CMD_Get_Name = 0x3e.toByte()
|
||||
const val CMD_Get_SPORTData = 0x5C.toByte()
|
||||
const val CMD_Get_Bloodsugar = 0x78.toByte()
|
||||
const val Bloodsugar_data = 0x3a.toByte() //血糖数据
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
public enum AutoMode {
|
||||
AutoHeartRate, AutoSpo2,AutoTemp,AutoHrv
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
enum class AutoMode {
|
||||
AutoHeartRate, AutoSpo2, AutoTemp, AutoHrv
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
public enum AutoTestMode {
|
||||
AutoHeartRate, AutoSpo2,
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
enum class AutoTestMode {
|
||||
AutoHeartRate, AutoSpo2
|
||||
}
|
||||
@ -1,87 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
|
||||
public class Clock extends SendData implements Serializable {
|
||||
|
||||
int number;
|
||||
int type;
|
||||
int hour;
|
||||
int minute;
|
||||
byte week;
|
||||
String content;
|
||||
boolean enable;
|
||||
|
||||
public boolean isEnable() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(int number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getHour() {
|
||||
return hour;
|
||||
}
|
||||
|
||||
public void setHour(int hour) {
|
||||
this.hour = hour;
|
||||
}
|
||||
|
||||
public int getMinute() {
|
||||
return minute;
|
||||
}
|
||||
|
||||
public void setMinute(int minute) {
|
||||
this.minute = minute;
|
||||
}
|
||||
|
||||
public int getWeek() {
|
||||
return week;
|
||||
}
|
||||
|
||||
public void setWeek(byte week) {
|
||||
this.week = week;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Clock{" +
|
||||
"number=" + number +
|
||||
", type=" + type +
|
||||
", hour=" + hour +
|
||||
", minute=" + minute +
|
||||
", week=" + week +
|
||||
", content='" + content + '\'' +
|
||||
", enable=" + enable +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
class Clock : SendData(), Serializable {
|
||||
var number = 0
|
||||
var type = 0
|
||||
var hour = 0
|
||||
var minute = 0
|
||||
var week: Byte = 0
|
||||
var content: String? = null
|
||||
var isEnable = false
|
||||
fun srgetWeek(): Int {
|
||||
return week.toInt()
|
||||
}
|
||||
|
||||
fun srsetWeek(week: Byte) {
|
||||
this.week = week
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Clock{" +
|
||||
"number=" + number +
|
||||
", type=" + type +
|
||||
", hour=" + hour +
|
||||
", minute=" + minute +
|
||||
", week=" + week +
|
||||
", content='" + content + '\'' +
|
||||
", enable=" + isEnable +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@ -1,103 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
|
||||
|
||||
public class Device implements Serializable{
|
||||
String name;//设备名字
|
||||
String mac;//设备的mac
|
||||
int productID;//产品id,预留
|
||||
BluetoothDevice getBluetoothDevice;//蓝牙
|
||||
boolean isconted=false;//蓝牙是否连接
|
||||
boolean IsPaired=false;//是否是配对设备
|
||||
boolean isdfu=false;//是否直接升级
|
||||
int riss=100;
|
||||
|
||||
public int getRiss() {
|
||||
return riss;
|
||||
}
|
||||
|
||||
public void setRiss(int riss) {
|
||||
this.riss = riss;
|
||||
}
|
||||
|
||||
ScheduledThreadPoolExecutor time=null;//每一个设备轮询器
|
||||
|
||||
public boolean isIsdfu() {
|
||||
return isdfu;
|
||||
}
|
||||
|
||||
public void setIsdfu(boolean isdfu) {
|
||||
this.isdfu = isdfu;
|
||||
}
|
||||
|
||||
public ScheduledThreadPoolExecutor getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(ScheduledThreadPoolExecutor time) {
|
||||
this.time = time;
|
||||
}
|
||||
public boolean isPaired() {
|
||||
return IsPaired;
|
||||
}
|
||||
|
||||
public void setPaired(boolean paired) {
|
||||
IsPaired = paired;
|
||||
}
|
||||
|
||||
public boolean isIsconted() {
|
||||
return isconted;
|
||||
}
|
||||
|
||||
public void setIsconted(boolean isconted) {
|
||||
this.isconted = isconted;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name==null?"":this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return mac==null?"":this.mac;
|
||||
}
|
||||
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
|
||||
public int getProductID() {
|
||||
return productID;
|
||||
}
|
||||
|
||||
public void setProductID(int productID) {
|
||||
this.productID = productID;
|
||||
}
|
||||
|
||||
public BluetoothDevice getBluetoothDevice() {
|
||||
return getBluetoothDevice;
|
||||
}
|
||||
|
||||
public void setBluetoothDevice(BluetoothDevice bluetoothDevice) {
|
||||
this.getBluetoothDevice = bluetoothDevice;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Device{" +
|
||||
"name='" + name + '\'' +
|
||||
", mac='" + mac + '\'' +
|
||||
", productID=" + productID +
|
||||
", getBluetoothDevice=" + getBluetoothDevice +
|
||||
", isconted=" + isconted +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
import android.bluetooth.BluetoothDevice
|
||||
import java.io.Serializable
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor
|
||||
|
||||
class Device : Serializable {
|
||||
var name: String? = null //设备名字
|
||||
var mac: String? = null //设备的mac
|
||||
var productID = 0 //产品id,预留
|
||||
var bluetoothDevice: BluetoothDevice? = null //蓝牙
|
||||
var isIsconted = false //蓝牙是否连接
|
||||
var isPaired = false //是否是配对设备
|
||||
var isIsdfu = false //是否直接升级
|
||||
var riss = 100
|
||||
var time: ScheduledThreadPoolExecutor? = null //每一个设备轮询器
|
||||
fun srsetIsdfu(isdfu: Boolean) {
|
||||
isIsdfu = isdfu
|
||||
}
|
||||
|
||||
fun srsetIsconted(isconted: Boolean) {
|
||||
isIsconted = isconted
|
||||
}
|
||||
|
||||
fun srgetName(): String {
|
||||
return if (name == null) "" else name!!
|
||||
}
|
||||
|
||||
fun srsetName(name: String?) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
fun srgetMac(): String {
|
||||
return if (mac == null) "" else mac!!
|
||||
}
|
||||
|
||||
fun srsetMac(mac: String?) {
|
||||
this.mac = mac
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Device{" +
|
||||
"name='" + name + '\'' +
|
||||
", mac='" + mac + '\'' +
|
||||
", productID=" + productID +
|
||||
", getBluetoothDevice=" + bluetoothDevice +
|
||||
", isconted=" + isIsconted +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/4/28.
|
||||
*/
|
||||
|
||||
public class DeviceBean {
|
||||
List<Map<String,String>>dataList;
|
||||
boolean finish;
|
||||
|
||||
public List<Map<String, String>> getDataList() {
|
||||
return dataList;
|
||||
}
|
||||
|
||||
public void setDataList(List<Map<String, String>> dataList) {
|
||||
this.dataList = dataList;
|
||||
}
|
||||
|
||||
public boolean isFinish() {
|
||||
return finish;
|
||||
}
|
||||
|
||||
public void setFinish(boolean finish) {
|
||||
this.finish = finish;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/4/28.
|
||||
*/
|
||||
class DeviceBean {
|
||||
var dataList: List<Map<String, String>>? = null
|
||||
var isFinish = false
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/4/9.
|
||||
*/
|
||||
|
||||
public class DeviceName extends SendData{
|
||||
String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/4/9.
|
||||
*/
|
||||
class DeviceName : SendData() {
|
||||
var name: String? = null
|
||||
}
|
||||
@ -1,56 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/8/2.
|
||||
*/
|
||||
|
||||
public class ExerciseMode extends SendData {
|
||||
public static final int Status_START=1;
|
||||
public static final int Status_PAUSE=2;
|
||||
public static final int Status_CONTUINE=3;
|
||||
public static final int Status_FINISH=4;
|
||||
|
||||
public static final int Mode_RUN=0;
|
||||
public static final int Mode_CYCLING=1;
|
||||
public static final int Mode_BADMINTON=2;
|
||||
public static final int Mode_FOOTBALL=3;
|
||||
public static final int Mode_TENNIS=4;
|
||||
public static final int Mode_YOGA=5;
|
||||
public static final int Mode_BREATH=6;
|
||||
public static final int Mode_DANCE=7;
|
||||
public static final int Mode_BASKETBALL=8;
|
||||
public static final int Mode_Walk=9;
|
||||
public static final int Mode_workout=10;
|
||||
public static final int Mode_Cricket=11;
|
||||
public static final int Mode_Hiking=12;
|
||||
public static final int Mode_Aerobics=13;
|
||||
public static final int Mode_PingPong=14;
|
||||
public static final int Mode_RopeJump=15;
|
||||
public static final int Mode_Situps=16;
|
||||
public static final int Volleyball=17;
|
||||
|
||||
|
||||
public static int[]modes=new int[]{Mode_RUN,Mode_CYCLING,Mode_BADMINTON,Mode_FOOTBALL,
|
||||
Mode_TENNIS,Mode_YOGA,Mode_BREATH,Mode_DANCE,Mode_BASKETBALL,Mode_Walk,Mode_workout
|
||||
,Mode_Cricket,Mode_Hiking,Mode_Aerobics,Mode_PingPong, Mode_RopeJump,Mode_Situps,Volleyball};
|
||||
int exerciseMode;
|
||||
int enableStatus;
|
||||
public int getExerciseMode(int position){
|
||||
return modes[position];
|
||||
}
|
||||
public int getExerciseMode() {
|
||||
return exerciseMode;
|
||||
}
|
||||
|
||||
public void setExerciseMode(int exerciseMode) {
|
||||
this.exerciseMode = exerciseMode;
|
||||
}
|
||||
|
||||
public int getEnableStatus() {
|
||||
return enableStatus;
|
||||
}
|
||||
|
||||
public void setEnableStatus(int enableStatus) {
|
||||
this.enableStatus = enableStatus;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/8/2.
|
||||
*/
|
||||
class ExerciseMode : SendData() {
|
||||
var exerciseMode = 0
|
||||
var enableStatus = 0
|
||||
fun getExerciseMode(position: Int): Int {
|
||||
return modes[position]
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val Status_START = 1
|
||||
const val Status_PAUSE = 2
|
||||
const val Status_CONTUINE = 3
|
||||
const val Status_FINISH = 4
|
||||
const val Mode_RUN = 0
|
||||
const val Mode_CYCLING = 1
|
||||
const val Mode_BADMINTON = 2
|
||||
const val Mode_FOOTBALL = 3
|
||||
const val Mode_TENNIS = 4
|
||||
const val Mode_YOGA = 5
|
||||
const val Mode_BREATH = 6
|
||||
const val Mode_DANCE = 7
|
||||
const val Mode_BASKETBALL = 8
|
||||
const val Mode_Walk = 9
|
||||
const val Mode_workout = 10
|
||||
const val Mode_Cricket = 11
|
||||
const val Mode_Hiking = 12
|
||||
const val Mode_Aerobics = 13
|
||||
const val Mode_PingPong = 14
|
||||
const val Mode_RopeJump = 15
|
||||
const val Mode_Situps = 16
|
||||
const val Volleyball = 17
|
||||
var modes = intArrayOf(
|
||||
Mode_RUN, Mode_CYCLING, Mode_BADMINTON, Mode_FOOTBALL,
|
||||
Mode_TENNIS, Mode_YOGA, Mode_BREATH, Mode_DANCE, Mode_BASKETBALL, Mode_Walk, Mode_workout, Mode_Cricket, Mode_Hiking, Mode_Aerobics, Mode_PingPong, Mode_RopeJump, Mode_Situps, Volleyball
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1,50 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Nordic Semiconductor
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
|
||||
|
||||
public class ExtendedBluetoothDevice {
|
||||
/* package */public static final int NO_RSSI = -1000;
|
||||
public final BluetoothDevice device;
|
||||
/** The name is not parsed by some Android devices, f.e. Sony Xperia Z1 with Android 4.3 (C6903). It needs to be parsed manually. */
|
||||
public String name;
|
||||
public int rssi;
|
||||
|
||||
|
||||
public ExtendedBluetoothDevice(BluetoothDevice device, String name, int rssi) {
|
||||
this.device = device;
|
||||
this.name = name;
|
||||
this.rssi=rssi;
|
||||
}
|
||||
|
||||
public ExtendedBluetoothDevice(final BluetoothDevice device) {
|
||||
this.device = device;
|
||||
this.name = device.getName();
|
||||
this.rssi = NO_RSSI;
|
||||
}
|
||||
|
||||
public boolean matches(final BluetoothDevice mdevice) {
|
||||
return device.getAddress().equals(mdevice.getAddress());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2015, Nordic Semiconductor
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
import android.bluetooth.BluetoothDevice
|
||||
|
||||
class ExtendedBluetoothDevice {
|
||||
val device: BluetoothDevice
|
||||
|
||||
/** The name is not parsed by some Android devices, f.e. Sony Xperia Z1 with Android 4.3 (C6903). It needs to be parsed manually. */
|
||||
var name: String
|
||||
var rssi: Int
|
||||
|
||||
constructor(device: BluetoothDevice, name: String, rssi: Int) {
|
||||
this.device = device
|
||||
this.name = name
|
||||
this.rssi = rssi
|
||||
}
|
||||
|
||||
constructor(device: BluetoothDevice) {
|
||||
this.device = device
|
||||
name = device.name
|
||||
rssi = NO_RSSI
|
||||
}
|
||||
|
||||
fun matches(mdevice: BluetoothDevice): Boolean {
|
||||
return device.address == mdevice.address
|
||||
}
|
||||
|
||||
companion object {
|
||||
/* package */
|
||||
const val NO_RSSI = -1000
|
||||
}
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
|
||||
public class MyAutomaticHRMonitoring extends SendData{
|
||||
int open;//1 开启整个时间段都测量 2时间段内间隔测量 0关闭
|
||||
// 1. Enable measurement throughout the entire time period 2. Measure intervals within the time period 0. Close
|
||||
int startHour;//开始小时 Starting hours
|
||||
int startMinute;//开始分钟 Start minute
|
||||
int endHour;//结束小时 End Hour
|
||||
int endMinute;//结束分钟 End minute
|
||||
int week;//星期一到星期日 开启选择 Monday to Sunday open selection
|
||||
int time;//多少时间测试一次,单位是分钟。 How many times does it take to test, in minutes.
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(int time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public int getOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
public void setOpen(int open) {
|
||||
this.open = open;
|
||||
}
|
||||
|
||||
public int getStartHour() {
|
||||
return startHour;
|
||||
}
|
||||
|
||||
public void setStartHour(int startHour) {
|
||||
this.startHour = startHour;
|
||||
}
|
||||
|
||||
public int getStartMinute() {
|
||||
return startMinute;
|
||||
}
|
||||
|
||||
public void setStartMinute(int startMinute) {
|
||||
this.startMinute = startMinute;
|
||||
}
|
||||
|
||||
public int getEndHour() {
|
||||
return endHour;
|
||||
}
|
||||
|
||||
public void setEndHour(int endHour) {
|
||||
this.endHour = endHour;
|
||||
}
|
||||
|
||||
public int getEndMinute() {
|
||||
return endMinute;
|
||||
}
|
||||
|
||||
public void setEndMinute(int endMinute) {
|
||||
this.endMinute = endMinute;
|
||||
}
|
||||
|
||||
public int getWeek() {
|
||||
return week;
|
||||
}
|
||||
|
||||
public void setWeek(int week) {
|
||||
this.week = week;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MyAutomaticHRMonitoring{" +
|
||||
"open=" + open +
|
||||
", startHour=" + startHour +
|
||||
", startMinute=" + startMinute +
|
||||
", endHour=" + endHour +
|
||||
", endMinute=" + endMinute +
|
||||
", week=" + week +
|
||||
", time=" + time +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
class MyAutomaticHRMonitoring : SendData() {
|
||||
var open = 0 //1 开启整个时间段都测量 2时间段内间隔测量 0关闭
|
||||
|
||||
// 1. Enable measurement throughout the entire time period 2. Measure intervals within the time period 0. Close
|
||||
var startHour = 0 //开始小时 Starting hours
|
||||
var startMinute = 0 //开始分钟 Start minute
|
||||
var endHour = 0 //结束小时 End Hour
|
||||
var endMinute = 0 //结束分钟 End minute
|
||||
var week = 0 //星期一到星期日 开启选择 Monday to Sunday open selection
|
||||
var time = 0 //多少时间测试一次,单位是分钟。 How many times does it take to test, in minutes.
|
||||
override fun toString(): String {
|
||||
return "MyAutomaticHRMonitoring{" +
|
||||
"open=" + open +
|
||||
", startHour=" + startHour +
|
||||
", startMinute=" + startMinute +
|
||||
", endHour=" + endHour +
|
||||
", endMinute=" + endMinute +
|
||||
", week=" + week +
|
||||
", time=" + time +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@ -1,86 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
|
||||
public class MyDeviceTime extends SendData{
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
int hour;
|
||||
int minute;
|
||||
int second;
|
||||
|
||||
public MyDeviceTime() {
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
this.year=calendar.get(Calendar.YEAR);
|
||||
this.month=calendar.get(Calendar.MONTH)+1;
|
||||
this.day=calendar.get(Calendar.DAY_OF_MONTH);
|
||||
this.hour=calendar.get(Calendar.HOUR_OF_DAY);
|
||||
this.minute=calendar.get(Calendar.MINUTE);
|
||||
this.second=calendar.get(Calendar.SECOND);
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(int month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public int getDay() {
|
||||
return day;
|
||||
}
|
||||
|
||||
public void setDay(int day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
public int getHour() {
|
||||
return hour;
|
||||
}
|
||||
|
||||
public void setHour(int hour) {
|
||||
this.hour = hour;
|
||||
}
|
||||
|
||||
public int getMinute() {
|
||||
return minute;
|
||||
}
|
||||
|
||||
public void setMinute(int minute) {
|
||||
this.minute = minute;
|
||||
}
|
||||
|
||||
public int getSecond() {
|
||||
return second;
|
||||
}
|
||||
|
||||
public void setSecond(int second) {
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MyDeviceTime{" +
|
||||
"year=" + year +
|
||||
", month=" + month +
|
||||
", day=" + day +
|
||||
", hour=" + hour +
|
||||
", minute=" + minute +
|
||||
", second=" + second +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
import java.util.Calendar
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
class MyDeviceTime : SendData() {
|
||||
var year: Int
|
||||
var month: Int
|
||||
var day: Int
|
||||
var hour: Int
|
||||
var minute: Int
|
||||
var second: Int
|
||||
|
||||
init {
|
||||
val calendar = Calendar.getInstance()
|
||||
year = calendar[Calendar.YEAR]
|
||||
month = calendar[Calendar.MONTH] + 1
|
||||
day = calendar[Calendar.DAY_OF_MONTH]
|
||||
hour = calendar[Calendar.HOUR_OF_DAY]
|
||||
minute = calendar[Calendar.MINUTE]
|
||||
second = calendar[Calendar.SECOND]
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "MyDeviceTime{" +
|
||||
"year=" + year +
|
||||
", month=" + month +
|
||||
", day=" + day +
|
||||
", hour=" + hour +
|
||||
", minute=" + minute +
|
||||
", second=" + second +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
|
||||
public class MyPersonalInfo extends SendData{
|
||||
int sex;//1 male,0female
|
||||
int age;
|
||||
int height;
|
||||
int weight;
|
||||
int stepLength=70;
|
||||
|
||||
|
||||
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(int weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public int getStepLength() {
|
||||
return stepLength;
|
||||
}
|
||||
|
||||
public void setStepLength(int stepLength) {
|
||||
this.stepLength = stepLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MyPersonalInfo{" +
|
||||
"sex=" + sex +
|
||||
", age=" + age +
|
||||
", height=" + height +
|
||||
", weight=" + weight +
|
||||
", stepLength=" + stepLength +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
class MyPersonalInfo : SendData() {
|
||||
var sex = 0 //1 male,0female
|
||||
var age = 0
|
||||
var height = 0
|
||||
var weight = 0
|
||||
var stepLength = 70
|
||||
override fun toString(): String {
|
||||
return "MyPersonalInfo{" +
|
||||
"sex=" + sex +
|
||||
", age=" + age +
|
||||
", height=" + height +
|
||||
", weight=" + weight +
|
||||
", stepLength=" + stepLength +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@ -1,94 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
|
||||
public class MySedentaryReminder extends SendData{
|
||||
int startHour;
|
||||
int startMinute;
|
||||
int endHour;
|
||||
int endMinute;
|
||||
int week;
|
||||
int intervalTime;
|
||||
int leastStep;
|
||||
boolean enable;
|
||||
|
||||
public boolean isEnable() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public int getStartHour() {
|
||||
return startHour;
|
||||
}
|
||||
|
||||
public void setStartHour(int startHour) {
|
||||
this.startHour = startHour;
|
||||
}
|
||||
|
||||
public int getStartMinute() {
|
||||
return startMinute;
|
||||
}
|
||||
|
||||
public void setStartMinute(int startMinute) {
|
||||
this.startMinute = startMinute;
|
||||
}
|
||||
|
||||
public int getEndHour() {
|
||||
return endHour;
|
||||
}
|
||||
|
||||
public void setEndHour(int endHour) {
|
||||
this.endHour = endHour;
|
||||
}
|
||||
|
||||
public int getEndMinute() {
|
||||
return endMinute;
|
||||
}
|
||||
|
||||
public void setEndMinute(int endMinute) {
|
||||
this.endMinute = endMinute;
|
||||
}
|
||||
|
||||
public int getWeek() {
|
||||
return week;
|
||||
}
|
||||
|
||||
public void setWeek(int week) {
|
||||
this.week = week;
|
||||
}
|
||||
|
||||
public int getIntervalTime() {
|
||||
return intervalTime;
|
||||
}
|
||||
|
||||
public void setIntervalTime(int intervalTime) {
|
||||
this.intervalTime = intervalTime;
|
||||
}
|
||||
|
||||
public int getLeastStep() {
|
||||
return leastStep;
|
||||
}
|
||||
|
||||
public void setLeastStep(int leastStep) {
|
||||
this.leastStep = leastStep;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MySedentaryReminder{" +
|
||||
"startHour=" + startHour +
|
||||
", startMinute=" + startMinute +
|
||||
", endHour=" + endHour +
|
||||
", endMinute=" + endMinute +
|
||||
", week=" + week +
|
||||
", intervalTime=" + intervalTime +
|
||||
", leastStep=" + leastStep +
|
||||
", enable=" + enable +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
class MySedentaryReminder : SendData() {
|
||||
var startHour = 0
|
||||
var startMinute = 0
|
||||
var endHour = 0
|
||||
var endMinute = 0
|
||||
var week = 0
|
||||
var intervalTime = 0
|
||||
var leastStep = 0
|
||||
var isEnable = false
|
||||
override fun toString(): String {
|
||||
return "MySedentaryReminder{" +
|
||||
"startHour=" + startHour +
|
||||
", startMinute=" + startMinute +
|
||||
", endHour=" + endHour +
|
||||
", endMinute=" + endMinute +
|
||||
", week=" + week +
|
||||
", intervalTime=" + intervalTime +
|
||||
", leastStep=" + leastStep +
|
||||
", enable=" + isEnable +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
|
||||
public class Notifier extends SendData{
|
||||
public static final int Data_Tel=0;
|
||||
public static final int Data_Sms=1;
|
||||
public static final int Data_WeChat=2;
|
||||
public static final int Data_Facebook=3;
|
||||
public static final int Data_Instagram=4;
|
||||
public static final int Data_Skype=5;
|
||||
public static final int Data_Telegram=6;
|
||||
public static final int Data_Twitter=7;
|
||||
public static final int Data_Vkclient=8;
|
||||
public static final int Data_WhatApp=9;
|
||||
public static final int Data_QQ=10;
|
||||
public static final int Data_IN=11;
|
||||
public static final int Data_Stop_Tel=0xff;
|
||||
|
||||
int type;
|
||||
String info="";
|
||||
String title="";
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(String info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Notifier{" +
|
||||
"type=" + type +
|
||||
", info='" + info + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
class Notifier : SendData() {
|
||||
var type = 0
|
||||
var info = ""
|
||||
var title = ""
|
||||
override fun toString(): String {
|
||||
return "Notifier{" +
|
||||
"type=" + type +
|
||||
", info='" + info + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
'}'
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val Data_Tel = 0
|
||||
const val Data_Sms = 1
|
||||
const val Data_WeChat = 2
|
||||
const val Data_Facebook = 3
|
||||
const val Data_Instagram = 4
|
||||
const val Data_Skype = 5
|
||||
const val Data_Telegram = 6
|
||||
const val Data_Twitter = 7
|
||||
const val Data_Vkclient = 8
|
||||
const val Data_WhatApp = 9
|
||||
const val Data_QQ = 10
|
||||
const val Data_IN = 11
|
||||
const val Data_Stop_Tel = 0xff
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/4/8.
|
||||
*/
|
||||
|
||||
public class SendData {
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/4/8.
|
||||
*/
|
||||
open class SendData
|
||||
@ -1,89 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
|
||||
public class SportPeriod extends SendData {
|
||||
int startHour;
|
||||
int startMinute;
|
||||
int endHour;
|
||||
int endMinute;
|
||||
int week;
|
||||
int days;
|
||||
int intervalTime;
|
||||
int leastStep;
|
||||
boolean enable;
|
||||
|
||||
public boolean isEnable() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public int getStartHour() {
|
||||
return startHour;
|
||||
}
|
||||
|
||||
public void setStartHour(int startHour) {
|
||||
this.startHour = startHour;
|
||||
}
|
||||
|
||||
public int getStartMinute() {
|
||||
return startMinute;
|
||||
}
|
||||
|
||||
public void setStartMinute(int startMinute) {
|
||||
this.startMinute = startMinute;
|
||||
}
|
||||
|
||||
public int getEndHour() {
|
||||
return endHour;
|
||||
}
|
||||
|
||||
public void setEndHour(int endHour) {
|
||||
this.endHour = endHour;
|
||||
}
|
||||
|
||||
public int getEndMinute() {
|
||||
return endMinute;
|
||||
}
|
||||
|
||||
public void setEndMinute(int endMinute) {
|
||||
this.endMinute = endMinute;
|
||||
}
|
||||
|
||||
public int getWeek() {
|
||||
return week;
|
||||
}
|
||||
|
||||
public void setWeek(int week) {
|
||||
this.week = week;
|
||||
}
|
||||
|
||||
public int getIntervalTime() {
|
||||
return intervalTime;
|
||||
}
|
||||
|
||||
public void setIntervalTime(int intervalTime) {
|
||||
this.intervalTime = intervalTime;
|
||||
}
|
||||
|
||||
public int getLeastStep() {
|
||||
return leastStep;
|
||||
}
|
||||
|
||||
public void setLeastStep(int leastStep) {
|
||||
this.leastStep = leastStep;
|
||||
}
|
||||
|
||||
public int getDays() {
|
||||
return days;
|
||||
}
|
||||
|
||||
public void setDays(int days) {
|
||||
this.days = days;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/1/16.
|
||||
*/
|
||||
class SportPeriod : SendData() {
|
||||
var startHour = 0
|
||||
var startMinute = 0
|
||||
var endHour = 0
|
||||
var endMinute = 0
|
||||
var week = 0
|
||||
var days = 0
|
||||
var intervalTime = 0
|
||||
var leastStep = 0
|
||||
var isEnable = false
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
package com.jstyle.blesdk2301.model;
|
||||
|
||||
public class WeatherData {
|
||||
int tempNow;
|
||||
int tempHigh;
|
||||
int tempLow;
|
||||
String cityName="";
|
||||
int weatherId;
|
||||
|
||||
public int getTempNow() {
|
||||
return tempNow;
|
||||
}
|
||||
|
||||
public void setTempNow(int tempNow) {
|
||||
this.tempNow = tempNow;
|
||||
}
|
||||
|
||||
public int getTempHigh() {
|
||||
return tempHigh;
|
||||
}
|
||||
|
||||
public void setTempHigh(int tempHigh) {
|
||||
this.tempHigh = tempHigh;
|
||||
}
|
||||
|
||||
public int getTempLow() {
|
||||
return tempLow;
|
||||
}
|
||||
|
||||
public void setTempLow(int tempLow) {
|
||||
this.tempLow = tempLow;
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
public int getWeatherId() {
|
||||
return weatherId;
|
||||
}
|
||||
|
||||
public void setWeatherId(int weatherId) {
|
||||
this.weatherId = weatherId;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.jstyle.blesdk2301.model
|
||||
|
||||
class WeatherData {
|
||||
var tempNow = 0
|
||||
var tempHigh = 0
|
||||
var tempLow = 0
|
||||
var cityName = ""
|
||||
var weatherId = 0
|
||||
}
|
||||
Loading…
Reference in New Issue