123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #include "sdk_common.h"
- #if NRF_MODULE_ENABLED(NFC_NDEF_LAUNCHAPP_REC)
- #include "nfc_launchapp_rec.h"
- #include <string.h>
- #include "nrf_error.h"
- #include "app_util.h"
- #include "nfc_ndef_record.h"
- const uint8_t ndef_android_launchapp_rec_type[] =
- {
- 'a', 'n', 'd', 'r', 'o', 'i', 'd', '.', 'c','o', 'm', ':', 'p', 'k', 'g'
- };
- const uint8_t ndef_windows_launchapp_rec_type[] =
- {
- 'w', 'i', 'n', 'd', 'o', 'w', 's', '.', 'c', 'o', 'm', '/', 'L', 'a', 'u',
- 'n', 'c', 'h', 'A', 'p', 'p'
- };
- const uint8_t ndef_windows_launchapp_plat_type[] =
- {
- 'W', 'i', 'n', 'd', 'o', 'w', 's', 'P', 'h', 'o', 'n', 'e'
- };
- #define WIN_LAUNCHAPP_EMPTY_PARAMETER 0x20
- ret_code_t nfc_win_launchapp_payload_constructor(win_launchapp_payload_desc_t * p_input,
- uint8_t * p_buff,
- uint32_t * p_len)
- {
- win_launchapp_payload_desc_t * launch_desc = (win_launchapp_payload_desc_t *) p_input;
- uint32_t temp_len = (uint32_t)launch_desc->platform_length + launch_desc->app_id_length + 7;
- if (p_buff != NULL)
- {
- if (temp_len > *p_len)
- {
- return NRF_ERROR_NO_MEM;
- }
- *p_buff++ = 0x00;
- *p_buff++ = 0x01;
- *p_buff++ = launch_desc->platform_length;
- memcpy(p_buff, launch_desc->platform, launch_desc->platform_length);
- p_buff += launch_desc->platform_length;
- *p_buff++ = launch_desc->app_id_length;
- memcpy(p_buff, launch_desc->app_id, launch_desc->app_id_length);
- p_buff += launch_desc->app_id_length;
- *p_buff++ = 0x00;
- *p_buff++ = 0x01;
- *p_buff++ = WIN_LAUNCHAPP_EMPTY_PARAMETER;
- }
- *p_len = temp_len;
- return NRF_SUCCESS;
- }
- #endif
|