语言

Menu
Sites
Language
Gear S2 NFC HCE problem

Greetings,

 

I would like to report a problem with your NFC web tutorials and ask for your assistance. I am developing in Tizen SDK 2.3.1 on Samsung Gear S2 with update R732XXU2BOKK.

 

I am using a Host Card Emulation mode of NFC and I already have custom reader, which works with other devices, so there is no problem. I have working AID also.

 

I was trying to develop both – a Web and Native applications. I was following your tutorials located at:

1. Web app: https://developer.tizen.org/ko/development/tutorials/web-application/tizen-features/network/nfc?langredirect=1#Using_NFC_Host_Based_Card_Emulation

2. Native app: https://developer.tizen.org/ko/development/tutorials/native-application/network/nfc#cardemulation

 

Sample code below, or full projects at GDrive: https://goo.gl/xhafcm

 

I encountered these problems:

Web app:

1. registering AID using manifest file – I was unable to use this method as there were no device listed while checking the registered AIDs,

2. registering AID using Tizen Web API within JavaScript file: there were actually no problems, but the device was simply not working with my verified reader.

Native app:

1. I was unable to launch the application as it fails somewhere inside service_app_create method.

 

I am sending you my sample code reflecting these problems. Web app registers AID using manifest file, while native app uses registration in code.

 

I would like to ask you what is the workflow to achieve these goals:

1. successfully register AID using Native implementation and using manifest file in Web app,

2. make the Gear S2 respond on attach to reader.

 

Also it would be useful if you could provide me some working HCE project.

 

Thank you in advance for your help.

 

Sincerely,
Roman Janás

 

Sample codes:

1. Web app manifest file:

<?xml version="1.0" encoding="utf-8"?>
<application name="wOqm5o2Mj2.NfcHceSample">
   <wallet>
      <aid-group category="other">
         <aid aid="F0010203040506"
              se_type="hce" unlock="false" power="sleep"/>
      </aid-group>
   </wallet>
</application>

 

2. Native app service_app_create method:

bool
service_app_create(void *data)
{
   bool is_nfc_supported = nfc_manager_is_supported();
   if (!is_nfc_supported) {
       dlog_print(DLOG_INFO, LOG_TAG, "is_nfc_supported NOT SUPPORTED");
   } else {
       dlog_print(DLOG_INFO, LOG_TAG, "is_nfc_supported SUPPORTED");
   }

   int ret = NFC_ERROR_NONE;
   nfc_se_card_emulation_mode_type_e ce_type;

   ret = nfc_manager_initialize();

   if (ret != NFC_ERROR_NONE)
   {
      dlog_print(DLOG_ERROR, LOG_TAG, "nfc_manager_initialize failed : %d", ret);

      return false;
   }

   // App control

   ret = nfc_se_get_card_emulation_mode(&ce_type);

   if (ret == NFC_ERROR_NONE && ce_type != true)
   {
      nfc_se_enable_card_emulation();
      if (ret != NFC_ERROR_NONE)
      {
         dlog_print(DLOG_ERROR, LOG_TAG, "nfc_se_enable_card_emulation failed : %d", ret);

         return false;
      }
   }
   else
   {
      dlog_print(DLOG_ERROR, LOG_TAG, "nfc_se_get_card_emulation_mode failed : %d", ret);

      return false;
   }

   ret = nfc_manager_set_hce_event_cb(_hce_event_cb, NULL);

   if (ret != NFC_ERROR_NONE)
   {
      dlog_print(DLOG_ERROR, LOG_TAG, "nfc_manager_set_hce_event_cb failed : %d", ret);

      return false;
   }

   // register AID
       ret = NFC_ERROR_NONE;

       const char aid[] = {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};

       ret = nfc_se_register_aid(NFC_SE_TYPE_HCE, NFC_CARD_EMULATION_CATEGORY_OTHER, aid);

       if (ret != NFC_ERROR_NONE)
       {
          dlog_print(DLOG_ERROR, LOG_TAG, "nfc_se_register_aid failed : %d", ret);

          return false;
       }

       ret = nfc_se_foreach_registered_aids(NFC_SE_TYPE_HCE, NFC_CARD_EMULATION_CATEGORY_OTHER,
                                            _registered_aid_cb, NULL);

       if (ret != NFC_ERROR_NONE)
       {
          dlog_print(DLOG_ERROR, LOG_TAG, "nfc_se_foreach_registered_aids failed : %d", ret);

          return false;
       }

   return true;
}
编辑者为: Roman Janás 12 4月, 2016

响应

3 回复
daniel kim

Hi,

According to this link, it seems that you need a contract with Samsung to get proper aid.

   https://developer.tizen.org/forums/general-support/gear-s2-eseembeded-secure-element%EC%97%90-access-%ED%95%98%EB%8A%94-%EB%B0%A9%EB%B2%95%EC%9D%84-%EB%AC%B8%EC%9D%98-%EB%93%9C%EB%A6%BD%EB%8B%88%EB%8B%A4.?tab=active

I would suggest you to ask your query to this board.

  https://help.content.samsung.com/csseller/main/main.do

Regards

Roman Janás

Thank you for your reply.

However I think this is not the case. You need to access Secure Element when using Card Emulation mode of NFC, as far as I know.

But I am using Host-based Card Emulation and I don't need to access SE. We already made a project on Android, where we are using Host-based Card Emulation (not Card Emulation) and this works without accessing Secure Element. So I was hoping to develop similar project in Tizen.

I am trying to use the HCE NFC as an access card for card reader, not for any kind of payment.

Whittle

Hi Roman,

Did you ever figure this out? Trying to do the same thing as you - use Gear S2 as an NFC access card for a card reader.