forked from eclipse-keyple/keyple-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added reading of another container in example
- Loading branch information
Showing
16 changed files
with
266 additions
and
164 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
38 changes: 0 additions & 38 deletions
38
...-omapi/src/main/java/org/eclipse/keyple/plugin/android/omapi/AndroidOmapiPluginFactory.kt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
...droid-omapi/src/main/java/org/eclipse/keyple/plugin/android/omapi/se/ISeServiceFactory.kt
This file was deleted.
Oops, something went wrong.
95 changes: 0 additions & 95 deletions
95
...c/main/java/org/eclipse/keyple/plugin/android/omapi/simalliance/SeServiceFactoryImpl.java
This file was deleted.
Oops, something went wrong.
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
58 changes: 58 additions & 0 deletions
58
...mapi/src/main/kotlin/org/eclipse/keyple/plugin/android/omapi/AndroidOmapiPluginFactory.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,58 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2019 Calypso Networks Association https://www.calypsonet-asso.org/ | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional information regarding copyright | ||
* ownership. | ||
* | ||
* This program and the accompanying materials are made available under the terms of the Eclipse | ||
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.keyple.plugin.android.omapi | ||
|
||
import android.content.Context | ||
import android.content.pm.PackageManager | ||
import org.eclipse.keyple.core.seproxy.AbstractPluginFactory | ||
import org.eclipse.keyple.core.seproxy.ReaderPlugin | ||
import org.eclipse.keyple.core.seproxy.exception.KeyplePluginInstantiationException | ||
|
||
/** | ||
* Build asynchronously the Android OMAPI plugin. | ||
* Platform incompabilities are not managed | ||
*/ | ||
class AndroidOmapiPluginFactory(private val context: Context) : AbstractPluginFactory() { | ||
|
||
companion object{ | ||
private const val SIMALLIANCE_OMAPI_PACKAGE_NAME = "org.simalliance.openmobileapi.service" | ||
} | ||
|
||
override fun getPluginName(): String { | ||
return AndroidOmapiPlugin.PLUGIN_NAME | ||
} | ||
|
||
//TODO throw error is Android is not compatible with OMAPI | ||
@Throws(KeyplePluginInstantiationException::class) | ||
override fun getPluginInstance(): ReaderPlugin{ | ||
return getReaderPluginRegardingOsVersion() | ||
} | ||
|
||
private fun getReaderPluginRegardingOsVersion(): ReaderPlugin{ | ||
return if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) | ||
org.eclipse.keyple.plugin.android.omapi.se.AndroidOmapiPluginImpl.init(context) | ||
else | ||
getReaderPluginRegardingPackages() | ||
} | ||
|
||
@Throws(KeyplePluginInstantiationException::class) | ||
private fun getReaderPluginRegardingPackages(): ReaderPlugin{ | ||
return try { | ||
context.packageManager | ||
.getPackageInfo(SIMALLIANCE_OMAPI_PACKAGE_NAME, 0) | ||
org.eclipse.keyple.plugin.android.omapi.simalliance.AndroidOmapiPluginImpl.init(context) | ||
} catch (e2: PackageManager.NameNotFoundException) { | ||
throw KeyplePluginInstantiationException("No OMAPI lib available within the OS") | ||
} | ||
|
||
} | ||
} |
File renamed without changes.
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
24 changes: 24 additions & 0 deletions
24
...c/main/kotlin/org/eclipse/keyple/plugin/android/omapi/simalliance/SeServiceFactoryImpl.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,24 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2018 Calypso Networks Association https://www.calypsonet-asso.org/ | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional information regarding copyright | ||
* ownership. | ||
* | ||
* This program and the accompanying materials are made available under the terms of the Eclipse | ||
* Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.keyple.plugin.android.omapi.simalliance | ||
|
||
import org.simalliance.openmobileapi.SEService | ||
import android.content.Context | ||
import org.eclipse.keyple.plugin.android.omapi.ISeServiceFactory | ||
|
||
|
||
internal class SeServiceFactoryImpl(private val applicationContext: Context): ISeServiceFactory<SEService, SEService.CallBack> { | ||
|
||
override fun connectToSe(callBack: SEService.CallBack): SEService { | ||
return SEService(applicationContext, callBack) | ||
} | ||
} |
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.