ret = smartcard_initialize();
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard initialize successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard initialize successful");
else
- TC_PRT("smartcard initialize failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard initialize failed");
</pre>
<p>The service is no longer needed, deinitialize it:</p>
<pre class="prettyprint">
ret = smartcard_deinitialize();
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard deinitialize successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard deinitialize successful");
else
- TC_PRT("smartcard deinitialize failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard deinitialize failed");
</pre>
</li>
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_get_readers successful");
- TC_PRT("readers length : %d", pLength);
- if (pLength > 0) {
- TC_PRT("reader handle : %d", phReaders[0]);
- }
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_get_readers successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "readers length : %d", pLength);
}
else
{
- TC_PRT("smartcard_get_readers failed : %d", ret);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_get_readers failed : %d", ret);
}
if(phReaders != NULL)
ret = smartcard_reader_get_name(reader, &pReader);
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_reader_get_name successful");
- TC_PRT("reader name : %s", pReader);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_reader_get_name successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "reader name : %s", pReader);
}
else
{
- TC_PRT("smartcard_reader_get_name failed : %d", ret);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_reader_get_name failed : %d", ret);
}
</pre>
</li>
ret = smartcard_reader_is_secure_element_present(reader, &is_present);
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_reader_is_secure_element_present successful");
- TC_PRT("reader secure element present : %d", is_present);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_reader_is_secure_element_present successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "reader secure element present : %d", is_present);
}
else
{
- TC_PRT("smartcard_reader_is_secure_element_present failed : %d", ret);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_reader_is_secure_element_present failed : %d", ret);
}
</pre>
</li>
ret = smartcard_reader_close_sessions(reader);
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_reader_close_sessions successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_reader_close_sessions successful");
}
else
{
- TC_PRT("smartcard_reader_close_sessions failed : %d", ret);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_reader_close_sessions failed : %d", ret);
}
}
else
{
- TC_PRT("open session failed : %d", ret);
+ dlog_print(DLOG_INFO, LOG_TAG, "open session failed : %d", ret);
}
</pre></li>
</ol>
ret = smartcard_reader_get_name(reader, &pReader);
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_session_get_reader successful");
- TC_PRT("reader name : %s", pReader);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_get_reader successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "reader name : %s", pReader);
}
else
{
- TC_PRT("smartcard_session_get_reader failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_get_reader failed");
}
</pre></li>
<li>Retrieve the answer to reset (ATR) of the SE:
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_session_get_atr successful : %d", pLength);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_get_atr successful : %d", pLength);
for (i = 0; i < pLength; i++)
- TC_PRT("%x ", (int)pAtr[i]);
+ dlog_print(DLOG_INFO, LOG_TAG, "%x ", (int)pAtr[i]);
}
else
{
- TC_PRT("smartcard_session_get_atr failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_get_atr failed");
}
</pre></li>
<li>Open a basic or logical channel.
ret = smartcard_session_open_basic_channel(session, aid, 4, 0x00, &channel);
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard_session_open_basic_channel successful : %d", channel);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_open_basic_channel successful : %d", channel);
else
- TC_PRT("smartcard_session_open_basic_channel failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_open_basic_channel failed");
// Open logical channel
ret = smartcard_session_open_logical_channel(session, aid, 12, 0x04, &channel);
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard_session_open_logical_channel successful : %d", (channel);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_open_logical_channel successful : %d", (channel);
else
- TC_PRT("smartcard_session_open_logical_channel failed : %d", ret);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_open_logical_channel failed : %d", ret);
</pre>
</li>
<li>Close all channels opened for a specific session:
ret = smartcard_session_close_channels(session);
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard_session_close_channels successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_close_channels successful");
else
- TC_PRT("smartcard_session_close_channels failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_close_channels failed");
</pre>
</li>
<li>Close a session and check that it is truly closed:
ret = smartcard_session_close(session);
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard_session_close successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_close successful");
else
- TC_PRT("smartcard_session_close failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_close failed");
ret = smartcard_session_is_closed(session, &is_closed);
if (ret == SMARTCARD_ERROR_NONE && is_closed == true)
- TC_PRT("smartcard_session_is_closed successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_is_closed successful");
else
- TC_PRT("smartcard_session_is_closed failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_session_is_closed failed");
</pre>
</li></ul>
ret = smartcard_channel_get_session(channel, &session_handle);
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard_channel_get_session successful: %d", session_handle);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_get_session successful: %d", session_handle);
else
- TC_PRT("smartcard_channel_get_session failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_get_session failed");
}
</pre></li>
ret = smartcard_channel_is_basic_channel(channel, &is_basic);
if (ret == SMARTCARD_ERROR_NONE && is_basic == false)
- TC_PRT("smartcard_channel_is_basic_channel successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_is_basic_channel successful");
else
- TC_PRT("smartcard_channel_is_basic_channel failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_is_basic_channel failed");
</pre></li>
<li>Select the next applet on the specific channel that matches to the partial Application ID (AID):
bool is_next = true;
ret = smartcard_channel_select_next(channel, &is_next);
if (ret == SMARTCARD_ERROR_NONE && is_next == false)
- TC_PRT("smartcard_channel_select_next successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_select_next successful");
else
- TC_PRT("smartcard_channel_select_next failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_select_next failed");
}
</pre>
<p>To get a response for the selection command, use the <span style="font-family: Courier New,Courier,monospace;">smartcard_channel_get_select_response()</span> function:</p>
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_channel_get_select_response successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_get_select_response successful");
for (i = 0; i < pLength; i++)
g_print("%x ", (int)pSelectResponse[i]);
}
else
{
- TC_PRT("smartcard_channel_get_select_response failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_get_select_response failed");
}
</pre>
</li>
ret = smartcard_channel_is_closed(channel, &is_close);
if (ret == SMARTCARD_ERROR_NONE && is_close == true)
- TC_PRT("smartcard_channel_is_closed successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_is_closed successful");
else
- TC_PRT("smartcard_channel_is_closed failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_is_closed failed");
</pre>
</li>
<li>Close the channel opened for a specific SE:
ret = smartcard_channel_close(channel);
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard_channel_close successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_close successful");
else
- TC_PRT("smartcard_channel_close failed : %d", ret);
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_close failed : %d", ret);
</pre>
</li>
<li>Transmit an APDU command (as per ISO/IEC 7816-4) to the SE:
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_channel_transmit successful");
- TC_PRT("response is ");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_transmit successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "response is ");
for (i = 0; i < resp_len; i++)
- TC_PRT("%x ", (int)response[i]);
- TC_PRT("\n");
+ dlog_print(DLOG_INFO, LOG_TAG, "%x ", (int)response[i]);
+ dlog_print(DLOG_INFO, LOG_TAG, "\n");
}
else
{
- TC_PRT("smartcard_channel_transmit failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_transmit failed");
}
</pre>
<p>To get a response for the transmission, use the <span style="font-family: Courier New,Courier,monospace;">smartcard_channel_transmit_retrieve_response()</span> function:</p>
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_channel_transmit_get_response successful");
- TC_PRT("response is ");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_transmit_get_response successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "response is ");
for (i = 0; i < pLength; i++)
- TC_PRT("%x ", (int)ptransmitResponse[i]);
- TC_PRT("\n");
+ dlog_print(DLOG_INFO, LOG_TAG, "%x ", (int)ptransmitResponse[i]);
+ dlog_print(DLOG_INFO, LOG_TAG, "\n");
}
else
{
- TC_PRT("smartcard_channel_transmit_get_response failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_transmit_get_response failed");
}
}
</pre>
ret = smartcard_initialize();
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard initialize successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard initialize successful");
else
- TC_PRT("smartcard initialize failed");</pre>
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard initialize failed");</pre>
</li>
<li>Get the available readers:
ret = smartcard_channel_transmit(channel, command, 4, &response, &resp_len);
if (ret == SMARTCARD_ERROR_NONE)
{
- TC_PRT("smartcard_channel_transmit successful");
- TC_PRT("response is ");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_transmit successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "response is ");
for (i = 0; i < resp_len; i++)
- TC_PRT("%x ", (int)response[i]);
- TC_PRT("\n");
+ dlog_print(DLOG_INFO, LOG_TAG, "%x ", (int)response[i]);
+ dlog_print(DLOG_INFO, LOG_TAG,"\n");
}
else
{
- TC_PRT("smartcard_channel_transmit failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard_channel_transmit failed");
}
}
}</pre>
ret = smartcard_deinitialize();
if (ret == SMARTCARD_ERROR_NONE)
- TC_PRT("smartcard deinitialize successful");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard deinitialize successful");
else
- TC_PRT("smartcard deinitialize failed");
+ dlog_print(DLOG_INFO, LOG_TAG, "smartcard deinitialize failed");
</pre>
</li>