Jump to content
43oh

CC3200 Wifi delay issue


Recommended Posts

I'll add something like that... was having trouble coming up with function names for how to name it :)

edit: eh, another goofy detail is there's no MACAddress class for storing & dumping MACs.  might have to make one...

Ok, here we go...

Client connected!  All clients:
Client 0 at IP=192.168.1.2, MAC=88:32:9b:47:74:7d
Client disconnected.

code:

  static int peerdevs = 0;
  int nowdevs = 0;

  nowdevs = WiFi.getTotalDevices();
  if (nowdevs > peerdevs) {
    Serial.println("Client connected!  All clients:");
    for (i=0; i < nowdevs; i++) {
      Serial.print("Client "); Serial.print(i); Serial.print(" at IP=");
      Serial.print(WiFi.deviceIpAddress(i));
      Serial.print(", MAC=");
      Serial.println(WiFi.deviceMacAddress(i));
    }
  }
  if (nowdevs < peerdevs) {
    Serial.println("Client disconnected.");
  }
  peerdevs = nowdevs;

The .macAddress() function was already taken so prepending device to those names makes more sense to me.  deviceMacAddress() writes a string to a privately-kept buffer that gets overwritten each subsequent execution of the command, that buffer is then returned as a const char * string for printing.  If we decide to make a MACAddress class to go alongside IPAddress, that will be improved.

 

Change committed to git (branch issue_480) for CC3200 & msp430/lm4f CC3100.

Link to post
Share on other sites

Awesome! These functions can be used to filter, identify, etc connected clients..

 

The private buffer could potentially be dangerous if users make the assumption that the pointer returned is unique and pointing to which ever device I asked it for.

Would a similar implementation as the .macAddress() work better?

uint8_t* WiFiClass::deviceMacAddress(uint8_t* mac)
Link to post
Share on other sites

One big caveat is the TCP connection needs to be SSL from the get-go; I don't see any way the CC3100 stack will let you open an unencrypted connection and then convert it into an SSL link (STARTTLS style).

The SSL demo project for the CC3200 explitely says that a connection cannot be up-graded to use SSL (nor can it be down-graded). It also mentions this as a limitation of the CC3200.

Link to post
Share on other sites

 

Awesome! These functions can be used to filter, identify, etc connected clients..

 

The private buffer could potentially be dangerous if users make the assumption that the pointer returned is unique and pointing to which ever device I asked it for.

Would a similar implementation as the .macAddress() work better?

uint8_t* WiFiClass::deviceMacAddress(uint8_t* mac)

Could do it that way, where the buffer is provided by the user.  I'll make that change now and push to the branch.

Link to post
Share on other sites
  • 2 weeks later...

Came up with a .deviceIpByMacAddress(const uint8_t *mac) and .deviceMacByIpAddress(IPAddress ip, char *sbuf) for obtaining an IPAddress object by 6-byte binary MAC, and user-readable MAC address from an IPAddress object.  Note those 2 are not reciprocals; the .deviceIpByMacAddress() expects the MAC in a 6-byte binary format, unlike the string returned by .deviceMacByIpAddress().

Attempting to connect to Network named: Test

You're connected to the network
Waiting for an ip address

IP Address obtained
SSID: Test
IP Address: 192.168.1.1
signal strength (RSSI):0 dBm
To see this page in action, open a browser to http://192.168.1.1
Starting webserver on port 80
Webserver started!
Client connected!  All clients:
Client 0 at IP=192.168.1.2, MAC=88:32:9b:47:74:7d
IP from phone: 192.168.1.2
MAC by phone IP: 88:32:9b:47:74:7d
Client disconnected.

Gotta copy my code over to msp430 and cc3200 (working with Tiva + CC3100 right now) and push to the branch.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...