SCMEnvironment

public class SCMEnvironment

Event provider for the ReaderEvents interface. A long polling strategy is used to receive new events from the SCM HTTP server. Every registered ReaderEvents is notified in case of event with the appropriate method.

This implementation of environment exists for legacy reason. Use SCMEmbedEnvironment to create a new environment to use.

Any number of SCMEnvironment, as well as SCWS objects from the javascript API, can receive copies of the same event from the SCM HTTP server. However, a same environment must not be used both in java and javascript (through an android.webkit.WebView) APIs.

Methods

addReaderEventListener

public void addReaderEventListener(ReaderEvents listener)

Registers a new ReaderEvents.

Parameters:
  • listener – The listener object whose methods will be called when an event occurs.

areCertificatesRegistered

public boolean areCertificatesRegistered()

Gets whether certificates are registered or not.

Returns:true if certificates are registered, false otherwise.

getReader

public Reader getReader(String name)

Gets the reader with the given name.

Parameters:
  • name – The reader name, as a string.
Returns:

the Reader object.

getReaders

public List<Reader> getReaders()

Returns the list of all smart card readers attached to the device.

Returns:the Reader list.

registerCertificates

public void registerCertificates(Token token)

Registers certificates.

Certificates are stored in app-specific storage. Registered certificates will be further used in SSL client certificate request through SSLWebViewClient.

Parameters:
  • token – the token to register certificates for.
Throws:

releaseBluetoothPeripheral

public boolean releaseBluetoothPeripheral()

Releases the current connected bluetooth peripheral.

Returns:return : true if the device has been released correctly false if the device does not exist and could not be released

removeReaderEventListener

public void removeReaderEventListener(ReaderEvents listener)

Removes a ReaderEvents listener.

Parameters:
  • listener – The listener object to remove.

startBluetoothScan

public boolean startBluetoothScan()

Starts bluetooth scan.

Throws:
  • SCMException – if bluetooth initialization failed or if a bluetooth peripheral is already paired and connected.
Returns:

false if scanning has already been started, true otherwise.

startRemoteLogsRecording

public void startRemoteLogsRecording(String userId)

Starts to record logs on Idopte remote server.

Note that logs are sensitive data and are sent through HTTPS protocol. userId must be a valid code provided by your administrator.

Calling this function will fail if a com.idopte.tools.Log is set up through com.idopte.tools.Log.setLog(com.idopte.tools.Log).

Parameters:
  • userId – id of user given by your administrator, as a String of digits.

stopBluetoothScan

public boolean stopBluetoothScan()

Stops bluetooth scan.

Throws:
Returns:

false if bluetooth has already been stopped, true otherwise.