@@ -52,6 +52,38 @@ int ST25DV::begin(uint8_t *buffer, uint16_t bufferLength)
5252 return NFCTAG_OK;
5353};
5454
55+ int ST25DV::writeText (String text, String iso_lang, NDEF_Text_encoding_t encoding)
56+ {
57+ NDEF_Text_info_t text_info;
58+
59+
60+ strcpy (text_info.text , text.c_str ());
61+ strcpy (text_info.language_code , iso_lang.c_str ());
62+ text_info.encoding = encoding;
63+
64+ return ndef.NDEF_WriteText (&text_info);
65+ }
66+
67+ int ST25DV::readText (String *text)
68+ {
69+ uint16_t ret;
70+ NDEF_Text_info_t info;
71+ sRecordInfo_t recordInfo;
72+
73+ ret = ndef.NDEF_IdentifyNDEF (&recordInfo);
74+ if (ret) {
75+ return ret;
76+ }
77+
78+ ret = ndef.NDEF_ReadText (&recordInfo, &info);
79+ if (ret) {
80+ return ret;
81+ }
82+ *text = String (info.text );
83+
84+ return 0 ;
85+ }
86+
5587int ST25DV::writeURI (String protocol, String uri, String info)
5688{
5789 sURI_Info _URI;
@@ -273,6 +305,80 @@ int ST25DV::readEMail(String *emailAdd, String *subject, String *message)
273305 return NDEF_OK;
274306}
275307
308+ /* *
309+ * @brief Writes a WIFI record
310+ *
311+ * @param SSID
312+ * @param auth: authentication type
313+ * @param enc: Encryption type
314+ * @param key
315+ * @retval success or failure
316+ */
317+ int ST25DV::writeWifi (String SSID, Ndef_Wifi_Authentication_t auth, Ndef_Wifi_Encryption_t enc, String key)
318+ {
319+ sWifiTokenInfo _wifi;
320+
321+ strncpy (_wifi.NetworkSSID , SSID.c_str (), 32 );
322+ strncpy (_wifi.NetworkKey , key.c_str (), 32 );
323+
324+ _wifi.AuthenticationType = auth;
325+ _wifi.EncryptionType = enc;
326+
327+ return ndef.NDEF_WriteWifiToken (&_wifi);
328+ }
329+
330+ int ST25DV::readWifi (sWifiTokenInfo *wifitoken)
331+ {
332+ uint16_t ret;
333+ sRecordInfo_t recordInfo;
334+
335+ ret = ndef.NDEF_IdentifyNDEF (&recordInfo);
336+ if (ret) {
337+ return ret;
338+ }
339+
340+ return ndef.NDEF_ReadWifiToken (&recordInfo, wifitoken);
341+
342+ }
343+
344+ int ST25DV::writeVcard (sVcardInfo vcard)
345+ {
346+
347+ return ndef.NDEF_WriteVcard (&vcard);
348+ }
349+
350+ int ST25DV::readVcard (sVcardInfo *vcard)
351+ {
352+ uint16_t ret;
353+ sRecordInfo_t recordInfo;
354+
355+ ret = ndef.NDEF_IdentifyNDEF (&recordInfo);
356+ if (ret) {
357+ return ret;
358+ }
359+
360+ return ndef.NDEF_ReadVcard (&recordInfo, vcard);
361+
362+ }
363+
364+ int ST25DV::appendAAR (String pkgName)
365+ {
366+ sAARInfo _info;
367+ strncpy (_info.PackageName , pkgName.c_str (), 80 );
368+
369+ return ndef.NDEF_AddAAR (&_info);
370+ }
371+
372+ int ST25DV::appendBluetoothOOB (Ndef_Bluetooth_OOB_t bluetooth, char *recordId)
373+ {
374+ return ndef.NDEF_AppendBluetoothOOB (&bluetooth, recordId);
375+ }
376+
377+ int ST25DV::writeMyApp (sMyAppInfo *pMyAppStruct)
378+ {
379+ return ndef.NDEF_WriteMyApp (pMyAppStruct);
380+ }
381+
276382/* *
277383 * @brief reads the type of NDEF on the tag
278384 * @param None
0 commit comments