Mobib

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
});

Get the MoBIB container service:

var mobib = gclClient.mobib(reader_id);

Call a function for the MoBIB container:

function callback(err,data) {
    if(err){console.log("Error:",JSON.stringify(err, null, '  '));}
    else {console.log(JSON.stringify(data, null, '  '));}
}
mobib.status(callback);

Obtain the Reader-ID

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);

This function call returns:

{
  "data": [
    {
      "card": {
        "atr": "3B6F0000805A2C23C310100511000111829000",
        "description": ["MOBIB Card"]
      },
      "id": "57a3e2e71c48cee9",
      "name": "Bit4id miniLector",
      "pinpad": false
    }
  ],
  "success": true
}

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:

gclClient.mobib(reader_id).status(callback);

An example callback:

function callback(err,data) {
    if(err){
        console.log("Error:",JSON.stringify(err, null, '  '));
    }
    else {
        console.log(JSON.stringify(data, null, '  '));
    }
}

Response:

{
  "data": {
    "active": true
  },
  "success": true
}

Card Issuing

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:

gclClient.mobib(reader_id).picture(callback);

Response:

{
  "data": "/9j/4AAQSkZJRgABA...59aVpcklSDzyKUTEDGK//9k=",
  "success": true
}

Contracts

The MoBIB card can contains contracts written by the operators (e.g. SNCB, De Lijn, MIVB, TEC).

The service can be called:

gclClient.mobib(reader_id).contracts(callback);

Response:

{
  "data": [
    {
      "authenticator_kvc": 17, 
      "authenticator_value": 587, 
      "journey_interchanges_allowed": false, 
      "passengers_max": 7, 
      "period_journeys": {
        "max_number_of_trips": 13, 
        "period": 2
      }, 
      "price_amount": 500, 
      "provider": 1, 
      "restrict_code": 5, 
      "restrict_time": 2, 
      "sale_date": "2014-03-06", 
      "sale_sam_count": 15, 
      "sale_sam_id": 25, 
      "spatials": [
        {
          "type": 7
        }
      ], 
      "tariff": {
        "counter": {
          "time": "2017-02-21T06:20:00", 
          "type": 4
        }, 
        "multimodal": true, 
        "nameref": 231
      }, 
      "validity_duration": {
        "unit": 2, 
        "value": 7
      }, 
      "validity_start_date": "2014-03-06", 
      "vehicle_class_allowed": 1, 
      "version": 4
    },
    {
      "authenticator_kvc": 18, 
      "authenticator_value": 588, 
      "journey_interchanges_allowed": false, 
      "passengers_max": 7, 
      "price_amount": 1000, 
      "provider": 1, 
      "sale_date": "2017-02-06", 
      "sale_sam_count": 1, 
      "sale_sam_id": 2, 
      "spatials": [
        {
          "type": 0
        }
      ], 
      "tariff": {
        "counter": {
          "journeys": "4", 
          "type": 5
        }, 
        "multimodal": true, 
        "nameref": 2
      }, 
      "validity_start_date": "2017-02-06", 
      "vehicle_class_allowed": 1, 
      "version": 4
    }
  ], 
  "success": true
}

Data Filter

Filter Card Data

All data on the smart card can be dumped at once, or using a filter. In order to read all data at once:

var filter = [];
gclClient.mobib(reader_id).allData(filter,callback);

Response:

{
  "data": {
    "active": false, 
    "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
    }, 
    "contracts": [
      {
      "authenticator_kvc": 17, 
      "authenticator_value": 587, 
      "journey_interchanges_allowed": false, 
      "passengers_max": 7, 
      "period_journeys": {
        "max_number_of_trips": 13, 
        "period": 2
      }, 
      "price_amount": 500, 
      "provider": 1, 
      "restrict_code": 5, 
      "restrict_time": 2, 
      "sale_date": "2014-03-06", 
      "sale_sam_count": 15, 
      "sale_sam_id": 25, 
      "spatials": [
        {
          "type": 7
        }
      ], 
      "tariff": {
        "counter": {
          "time": "2017-02-21T06:20:00", 
          "type": 4
        }, 
        "multimodal": true, 
        "nameref": 231
      }, 
      "validity_duration": {
        "unit": 2, 
        "value": 7
      }, 
      "validity_start_date": "2014-03-06", 
      "vehicle_class_allowed": 1, 
      "version": 4
    },
    {
      "authenticator_kvc": 18, 
      "authenticator_value": 588, 
      "journey_interchanges_allowed": false, 
      "passengers_max": 7, 
      "price_amount": 1000, 
      "provider": 1, 
      "sale_date": "2017-02-06", 
      "sale_sam_count": 1, 
      "sale_sam_id": 2, 
      "spatials": [
        {
          "type": 0
        }
      ], 
      "tariff": {
        "counter": {
          "journeys": "4", 
          "type": 5
        }, 
        "multimodal": true, 
        "nameref": 2
      }, 
      "validity_start_date": "2017-02-06", 
      "vehicle_class_allowed": 1, 
      "version": 4
    }

    ], 
    "picture": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
  }, 
  "success": true
}

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:

function callback(err,data) {
    if(err){
        console.log("Error:",JSON.stringify(err, null, '  '));
    }
    else {
        console.log(JSON.stringify(data, null, '  '));
    }
}

The error object returned:

{
  success: false,
  description: "some error description",
  code: "some error code"
}

For the error codes and description, see Status codes.

Last updated