-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50d9c1d
commit 3bb6f37
Showing
97 changed files
with
108,885 additions
and
125,551 deletions.
There are no files selected for viewing
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
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
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
Binary file not shown.
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
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
55 changes: 55 additions & 0 deletions
55
android/src/main/java/com/stario10module/StarIO10ErrorDetailWrapper.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.stario10module | ||
|
||
import com.facebook.react.bridge.* | ||
import com.starmicronics.stario10.* | ||
|
||
class StarIO10ErrorDetailWrapper internal constructor(context: ReactApplicationContext) : | ||
ReactContextBaseJavaModule(context) { | ||
override fun getName(): String { | ||
return "StarIO10ErrorDetailWrapper" | ||
} | ||
|
||
@ReactMethod | ||
fun getAutoSwitchInterfaceLanErrorIdentifier(identifier: String, promise: Promise) { | ||
getAutoSwitchInterfaceErrorIdentifier(identifier, promise, InterfaceType.Lan) | ||
} | ||
|
||
@ReactMethod | ||
fun getAutoSwitchInterfaceBluetoothErrorIdentifier(identifier: String, promise: Promise) { | ||
getAutoSwitchInterfaceErrorIdentifier(identifier, promise, InterfaceType.Bluetooth) | ||
} | ||
|
||
@ReactMethod | ||
fun getAutoSwitchInterfaceUsbErrorIdentifier(identifier: String, promise: Promise) { | ||
getAutoSwitchInterfaceErrorIdentifier(identifier, promise, InterfaceType.Usb) | ||
} | ||
|
||
@ReactMethod | ||
fun getAutoSwitchInterfaceBluetoothLEErrorIdentifier(identifier: String, promise: Promise) { | ||
getAutoSwitchInterfaceErrorIdentifier(identifier, promise, InterfaceType.BluetoothLE) | ||
} | ||
|
||
private fun getAutoSwitchInterfaceErrorIdentifier(identifier: String, promise: Promise, interfaceType: InterfaceType) { | ||
val errorDetail = InstanceManager.get(identifier) | ||
|
||
if (errorDetail is StarIO10ErrorDetail) { | ||
val error = errorDetail.autoSwitchInterfaceOpenErrors?.get(interfaceType) | ||
|
||
if (error != null) { | ||
val errorIdentifier = InstanceManager.set(error) | ||
promise.resolve(errorIdentifier) | ||
} else { | ||
promise.reject(ReactNoCrashSoftException("Not found Error of $identifier identifier")) | ||
} | ||
} else { | ||
promise.reject(ReactNoCrashSoftException("Not found $identifier identifier")) | ||
} | ||
} | ||
|
||
@ReactMethod | ||
fun dispose(identifier: String, promise: Promise) { | ||
InstanceManager.remove(identifier) | ||
|
||
promise.resolve(0) | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.