The MoBIB container facilitates communication with card readers and inserted MoBIB smart cards. The T1C-JS client library provides functionality to communicate with the smart card and facilitates integration into a web or native application.
This document describes the functionality provided by the MoBIB container on the T1C-GCL (Generic Connector Library).
Get MoBIB container object
For more information on how to configure the T1C-JS client library see Client Configuration.
Initialize a gclClient:
GCLLib.GCLClient.initialize(config,function(err, gclClient) {// gclClient ready to use});
The constructor for the MoBIB containers expects a valid reader-ID as parameter. A reader-ID can be obtained from the exposed core functionality, for more information see Core Services.
Core services responds with available card-readers, available card in a card-reader, etc.
For example:
In order to get all connected card-readers, with available cards:
var core =gclClient.core();core.readersCardAvailable(callback);
We notice that a card object is available in the response in the context of a detected reader.
The reader in the example above is Bit4id miniLector, has no pin-pad capabilities, and there is a card detected with given ATR and description "MOBIB Card". An ATR (Answer To Reset) identifies the type of a smart-card.
The reader, has a unique ID, reader_id; this reader_id must be used in order to request functionalities for the MoBIB card.
This must be done upon instantiation of the MoBIB container:
var mobib =gclClient.mobib(reader_id);
All methods for mobib will use the selected reader - identified by the reader_id.
Card data
Status
The MoBIB card can be locked, this means that application(s) on the MoBIB card have been locked by operators. To retrieve this information, the status of the MoBIB card can be requested. Note that this is not related to the expiry date of the card.
The service can be called:
The MoBIB card contains a information about the holder of the card.
The service can be called:
gclClient.mobib(reader_id).cardIssuing(callback);
Response:
{"data": {"card_expiration_date":"2016-01-31","card_holder_birth_date":"1964-07-23","card_holder_end_date":"2016-01-31","card_holder_id":"6060575401800002365","card_holder_name":"MIAO- ERH WANG LIU ","card_holder_start_date":"2012-02-11","card_revalidation_date":"2012-02-10","card_type":1,"company_id":18,"gender":1,"language":2,"version":1 },"success": true}
Picture
Contains the card holder's picture stored on the smart card. The service can be called:
The filter can be used to ask a list of custom data containers. For example, we want to read only the 'rn', 'picture' and 'rrn certificate':
var filter = ['status','card-issuing'];gclClient.mobib().allData(filter,callback);
Response:
{"data": {"active":true,"card-issuing": {"card_expiration_date":"2016-01-31","card_holder_birth_date":"1964-07-23","card_holder_end_date":"2016-01-31","card_holder_id":"6060575401800002365","card_holder_name":"MIAO- ERH WANG LIU ","card_holder_start_date":"2012-02-11","card_revalidation_date":"2012-02-10","card_type":1,"company_id":18,"gender":1,"language":2,"version":1 } },"success": true}
Error Handling
Error Object
The functions specified are asynchronous and always need a callback function.
The callback function will reply with a data object in case of success, or with an error object in case of an error. An example callback: