From: Jihoon Jung Date: Wed, 23 Sep 2015 02:19:29 +0000 (+0900) Subject: Smartcard tutorial change : TC_PRT -> dlog_print X-Git-Tag: tizen_3.0/TD_SYNC/20161201~452 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2da347acff0bf844d6f5b188ec09cfad16a7d3f;p=sdk%2Fonline-doc.git Smartcard tutorial change : TC_PRT -> dlog_print Signed-off-by: Ji-hoon Jung Change-Id: I37e1f4c2af0a1439fad8cfe48d9e7fc07d03d09c --- diff --git a/org.tizen.tutorials/html/native/network/smartcard_tutorial_n.htm b/org.tizen.tutorials/html/native/network/smartcard_tutorial_n.htm index 60c27a9..ebc0ad5 100644 --- a/org.tizen.tutorials/html/native/network/smartcard_tutorial_n.htm +++ b/org.tizen.tutorials/html/native/network/smartcard_tutorial_n.htm @@ -89,9 +89,9 @@ int ret; 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");

The service is no longer needed, deinitialize it:

@@ -99,9 +99,9 @@ int ret;
 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");
 
@@ -114,15 +114,12 @@ ret = smartcard_get_readers(&phReaders, &pLength); 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) @@ -144,12 +141,12 @@ char * pReader = 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); } @@ -163,12 +160,12 @@ bool is_present = false; 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); } @@ -186,16 +183,16 @@ if (ret == SMARTCARD_ERROR_NONE)    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); } @@ -215,12 +212,12 @@ ret = smartcard_session_get_reader(session, &reader); 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"); }
  • Retrieve the answer to reset (ATR) of the SE: @@ -234,13 +231,13 @@ ret = smartcard_session_get_atr(session, &pAtr, &pLength); 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"); }
  • Open a basic or logical channel. @@ -254,17 +251,17 @@ int 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);
  • Close all channels opened for a specific session: @@ -274,9 +271,9 @@ int ret; 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");
  • Close a session and check that it is truly closed: @@ -288,16 +285,16 @@ bool is_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");
  • @@ -318,9 +315,9 @@ if (ret == SMARTCARD_ERROR_NONE)    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"); } @@ -332,9 +329,9 @@ bool is_basic; 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");
  • Select the next applet on the specific channel that matches to the partial Application ID (AID): @@ -345,9 +342,9 @@ if (ret == SMARTCARD_ERROR_NONE)    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"); }

    To get a response for the selection command, use the smartcard_channel_get_select_response() function:

    @@ -360,13 +357,13 @@ ret = smartcard_channel_get_select_response(channel, &pSelectResponse, & 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"); }
  • @@ -381,9 +378,9 @@ ret = smartcard_channel_close(channel); 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");
  • Close the channel opened for a specific SE: @@ -394,9 +391,9 @@ int ret; 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);
  • Transmit an APDU command (as per ISO/IEC 7816-4) to the SE: @@ -412,15 +409,15 @@ ret = smartcard_channel_transmit(channel, command, 4, &response, &resp_l 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"); }

    To get a response for the transmission, use the smartcard_channel_transmit_retrieve_response() function:

    @@ -436,15 +433,15 @@ if (ret == SMARTCARD_ERROR_NONE)    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");    } } @@ -470,9 +467,9 @@ int resp_len = 50; 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");
  • Get the available readers: @@ -501,15 +498,15 @@ if (ret == SMARTCARD_ERROR_NONE && pLength != 0)          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");          }       }    } @@ -525,9 +522,9 @@ if (ret == SMARTCARD_ERROR_NONE && pLength != 0) 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");