Skip to content

Commit

Permalink
test: wifi media record
Browse files Browse the repository at this point in the history
  • Loading branch information
DeimosHall committed Dec 26, 2023
1 parent a9b2510 commit 24c1a4c
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 51 deletions.
52 changes: 8 additions & 44 deletions examples/NDEFSendMessage/NDEFSendMessage.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Note: If you know how to create custom NDEF messages, you can use the NDEFSendRawMessage example, otherwise, use this example.
*
* Authors:
* Salvador Mendoza - @Netxing - salmg.net
* Francisco Torres - Electronic Cats - electroniccats.com
*
* December 2023
Expand Down Expand Up @@ -33,50 +32,15 @@ void setup() {
;
Serial.println("Send NDEF Message with PN7150");

// message.addTextRecord("Hello"); // English by default
// message.addTextRecord("world", "en"); // English explicitly, the library only supports two letter language codes (ISO 639-1) by now
// message.addTextRecord("Hola mundo!", "es"); // Spanish explicitly, check a language code table at https://www.science.co.il/language/Locale-codes.php
// message.addTextRecord("Bonjour le monde!", "fr"); // French explicitly
// message.addUriRecord("google.com"); // No prefix explicitly
// message.addUriRecord("https://www.electroniccats.com"); // https://www. prefix explicitly, the library can handle all the prefixes listed at TODO: add link to prefixes table

message.addUriRecord("google.com");
message.addUriRecord("http://www.test1.com");
message.addUriRecord("https://www.test2.com");
message.addUriRecord("tel:123456789");
message.addTextRecord("Hello"); // English by default
message.addTextRecord("world", "en"); // English explicitly, the library only supports two letter language codes (ISO 639-1) by now
message.addTextRecord("Hola mundo!", "es"); // Spanish explicitly, check a language code table at https://www.science.co.il/language/Locale-codes.php
message.addTextRecord("Bonjour le monde!", "fr"); // French explicitly
message.addUriRecord("google.com"); // No prefix explicitly
message.addUriRecord("https://www.electroniccats.com"); // https://www. prefix explicitly, the library can handle all the prefixes listed at TODO: add link to prefixes table
message.addMimeMediaRecord("application/vnd.wfa.wsc", "Wi-Fi Easy Connect");
message.addUriRecord("tel:1234567890");
message.addUriRecord("mailto:deimoshallgmail.com"); // TODO: check @ problem
message.addUriRecord("ftp://anonymous:anonymous@test5");
message.addUriRecord("ftp://ftp.test6");
// message.addUriRecord("ftps://test7");
// message.addUriRecord("sftp://test8");
// message.addUriRecord("smb://test9");
// message.addUriRecord("nfs://test10");
// message.addUriRecord("ftp://test11");
// message.addUriRecord("dav://test12");
// message.addUriRecord("news:test13");
// message.addUriRecord("telnet://test14");
// message.addUriRecord("imap://test15");
// message.addUriRecord("rtsp://test16");
message.addUriRecord("urn:test17");
// message.addUriRecord("pop:test18");
// message.addUriRecord("sip:test19");
// message.addUriRecord("sips:test20");
// message.addUriRecord("tftp://test21");
// message.addUriRecord("btspp://test22");
// message.addUriRecord("btl2cap://test23");
// message.addUriRecord("btgoep://test24");
// message.addUriRecord("tcpobex://test25");
// message.addUriRecord("irdaobex://test26");
// message.addUriRecord("file://test27");

// message.addUriRecord("urn:epc:id:sgtin:0614141.107346.1");

message.addUriRecord("urn:epc:id:test28");
message.addUriRecord("urn:epc:tag:test29");
message.addUriRecord("urn:epc:pat:sgtin96:3.0614141.812345.6789");
message.addUriRecord("urn:epc:raw:test30");
message.addUriRecord("urn:epc:test31");
message.addUriRecord("urn:nfc:test32");
nfc.setSendMsgCallback(messageSentCallback);

Serial.println("Initializing...");
Expand Down
2 changes: 1 addition & 1 deletion examples/NDEFSendRawMessage/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BOARD_TAG = electroniccats:mbed_rp2040:bombercat
MONITOR_PORT = /dev/cu.usbmodem11401
MONITOR_PORT = /dev/cu.usbmodem11101

compile:
arduino-cli compile --fqbn $(BOARD_TAG)
Expand Down
120 changes: 114 additions & 6 deletions examples/NDEFSendRawMessage/NDEFSendRawMessage.ino
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,120 @@ NdefMessage message;
// 'e', 'l', 'e', 'c', 't', 'r', 'o', 'n', 'i', 'c', 'c', 'a', 't', 's', '.', 'c', 'o', 'm'}; // Message Payload

// One uri record "https://www.electroniccats.com"
const char ndefMessage[] = {0xD1,
0x01,
0x13,
'U',
0x02,
'e', 'l', 'e', 'c', 't', 'r', 'o', 'n', 'i', 'c', 'c', 'a', 't', 's', '.', 'c', 'o', 'm'};
// const char ndefMessage[] = {0xD1,
// 0x01,
// 0x13,
// 'U',
// 0x02,
// 'e', 'l', 'e', 'c', 't', 'r', 'o', 'n', 'i', 'c', 'c', 'a', 't', 's', '.', 'c', 'o', 'm'};

// const char ndefMessage[] = {0xD1, 0x02, 0x1A, 'a', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', '/', 'v', 'n', 'd', '.', 'w', 'f', 'a', '.', 'w', 's', 'c', 0x01, 0x00, 0x00, 0x00, 0x04, 't', 'e', 's', 't', 0x00, 0x00, 0x00, 0x01, 0x00, 'p', 'a', 's', 's', 'w', 'o', 'r', 'd'};
// One media record of type "application/vnd.wfa.wsc", with network name = test, Authentication type = OPEN, Encription type = WEP, Password = password
// D2 17 29 61 70 70 6C 69 63 61 74 69 6F 6E 2F 76 6E 64 2E 77 66 61 2E 77 73 63 10 0E 00 36 10 26 00 01 01 10 45 00 04 74 65 73 74 10 03 00 02 00 01 10 0F 00 02 00 01 10 27 00 08 70 61 73 73 77 6F 72 64
// const char ndefMessage[] = {0xD2,
// 0x17,
// 0x29,
// 0x61,
// 0x70,
// 0x70,
// 0x6C,
// 0x69,
// 0x63,
// 0x61,
// 0x74,
// 0x69,
// 0x6F,
// 0x6E,
// 0x2F,
// 0x76,
// 0x6E,
// 0x64,
// 0x2E,
// 0x77,
// 0x66,
// 0x61,
// 0x2E,
// 0x77,
// 0x73,
// 0x63,
// 0x10,
// 0x0E,
// 0x00,
// 0x36,
// 0x10,
// 0x26,
// 0x00,
// 0x01,
// 0x01,
// 0x10,
// 0x45,
// 0x00,
// 0x04,
// 0x74,
// 0x65,
// 0x73,
// 0x74,
// 0x10,
// 0x03,
// 0x00,
// 0x02,
// 0x00,
// 0x01,
// 0x10,
// 0x0F,
// 0x00,
// 0x02,
// 0x00,
// 0x01,
// 0x10,
// 0x27,
// 0x00,
// 0x08,
// 0x70,
// 0x61,
// 0x73,
// 0x73,
// 0x77,
// 0x6F,
// 0x72,
// 0x64};
// D2:17:29:61:61:70:70:6C:69:63:61:74:69:6F:6E:2F:76:6E:64:2E:77:66:61:2E:77:73:63:10:0E:00:36:10:26:00:01:01:10:45:00:04:74:65:73:74:10:03:00:02:00:01:10:0F:00:02:00:01:10:27:00:08:70:61:73:73:77:6F:72:64
const char ndefMessage[] = {
0xD2,
0X17,
0x29,
'a', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', '/', 'v', 'n', 'd', '.', 'w', 'f', 'a', '.', 'w', 's', 'c',
0x10,
0x0E,
0x00,
0x36,
0x10,
0x26,
0x00,
0x01,
0x01,
0x10,
0x45,
0x00,
0x04,
't', 'e', 's', 't',
0x10,
0x03,
0x00,
0x02,
0x00,
0x01,
0x10,
0x0F,
0x00,
0x02,
0x00,
0x01,
0x10,
0x27,
0x00,
0x08,
'p', 'a', 's', 's', 'w', 'o', 'r', 'd'};

void setup() {
Serial.begin(9600);
Expand Down
1 change: 1 addition & 0 deletions src/NdefMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class NdefMessage {
void addTextRecord(String text);
void addTextRecord(String text, String languageCode);
void addUriRecord(String uri);
void addMimeMediaRecord(String mimeType, String payload);
};

#endif

0 comments on commit 24c1a4c

Please sign in to comment.