This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"extends": ["react-app", "plugin:prettier/recommended"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"editor.formatOnSave": true, | |
"[javascript]": { | |
"editor.formatOnSave": false, | |
}, | |
"eslint.autoFixOnSave": true, | |
"eslint.alwaysShowStatus": true, | |
"prettier.disableLanguages": [ | |
"js" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root = true | |
[*] | |
indent_style = space | |
indent_size = 4 | |
tab_width = 4 | |
end_of_line = lf | |
charset = utf-8 | |
trim_trailing_whitespace = true | |
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
..., | |
rules: { | |
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], | |
"indent": [2, 4], | |
"react/jsx-indent": [2, 4], | |
"react/jsx-indent-props": [2, 4], | |
"react/prefer-stateless-function": [1, { "ignorePureComponents": true }], | |
"import/no-extraneous-dependencies": [1, {"peerDependencies": true}], | |
"import/no-extraneous-dependencies": "off", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BluetoothUtils { | |
companion object { | |
val ACTION_DISCOVERY_STARTED = "ACTION_DISCOVERY_STARTED" | |
val ACTION_DISCOVERY_STOPPED = "ACTION_DISCOVERY_STOPPED" | |
val ACTION_DEVICE_FOUND = "ACTION_DEVICE_FOUND" | |
val ACTION_DEVICE_CONNECTED = "ACTION_DEVICE_CONNECTED" | |
val ACTION_DEVICE_DISCONNECTED = "ACTION_DEVICE_DISCONNECTED" | |
val ACTION_MESSAGE_RECEIVED = "ACTION_MESSAGE_RECEIVED" | |
val ACTION_MESSAGE_SENT = "ACTION_MESSAGE_SENT" | |
val ACTION_CONNECTION_ERROR = "ACTION_CONNECTION_ERROR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IBluetoothSDKListener { | |
/** | |
* from action BluetoothUtils.ACTION_DISCOVERY_STARTED | |
*/ | |
fun onDiscoveryStarted() | |
/** | |
* from action BluetoothUtils.ACTION_DISCOVERY_STOPPED | |
*/ | |
fun onDiscoveryStopped() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BluetoothSDKListenerHelper { | |
companion object { | |
private var mBluetoothSDKBroadcastReceiver: BluetoothSDKBroadcastReceiver? = null | |
class BluetoothSDKBroadcastReceiver : BroadcastReceiver() { | |
private var mGlobalListener: IBluetoothSDKListener? = null | |
public fun setBluetoothSDKListener(listener: IBluetoothSDKListener) { | |
mGlobalListener = listener |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CoolFragment() : BottomSheetDialogFragment() { | |
private lateinit var mService: BluetoothSDKService | |
private lateinit var binding: FragmentPopupDiscoveredLabelerDeviceBinding | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
} | |
override fun onCreateView( | |
inflater: LayoutInflater, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BluetoothSDKService : Service() { | |
// Service Binder | |
private val binder = LocalBinder() | |
// Bluetooth stuff | |
private lateinit var bluetoothAdapter: BluetoothAdapter | |
private lateinit var pairedDevices: MutableSet<BluetoothDevice> | |
private var connectedDevice: BluetoothDevice? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Class used for the client Binder. | |
*/ | |
inner class LocalBinder : Binder() { | |
/** | |
* Enable the discovery, registering a broadcastreceiver {@link discoveryBroadcastReceiver} | |
* The discovery filter by LABELER_SERVER_TOKEN_NAME | |
*/ | |
public fun startDiscovery(context: Context) { |