Consultancy

cropped-JBRLogo.png

If you need help with the subject content of this blog: JBR Engineering Research Limited is the name of my engineering consultancy, specialising in: Concept and prototype development/construction; Production testing; MATLAB/Simulnk; Embedded systems; Mechatronics; Systems modelling and simulation; Software development; Control systems. See the landing page here:

3 thoughts on “Consultancy”

  1. Hello, john!
    I’m using yout library ESP8266wifi.h in my Arduino project.
    I need: ESP8266 configured as AP, Server.
    I want to receive GET requests.
    My problem is:
    I can’t get GET request. May be I not understand how ethernet working….
    Could you write an example how to get GET requests with your library?
    My code:
    I try to send GET request by Chrome:
    http://192.168.4.1/*IDN?

    My problem: I don’t see responce (200 OK)
    And function(processCommand(msg);) do not starts

    Details:
    At power-on I get in terminal:

    starting wi-fi…
    Ai-Thinker Technology Co. Ltd.
    ready
    AT+CWMODE=1
    OK
    ATE1
    OK
    AT+CIPMUX=1
    OK
    AT+CWMODE=3
    OK
    AT+CWSAP=”T-801″,”22222222″,5,3
    OK
    AT+CIPSERVER=1,80
    OK
    Started=1

    WIFI DISCONNECT
    0,CONNECT
    0,CLOSED
    0,CONNECT

    +IPD,0,398:GET /idn HTTP/1.1
    Host: 192.168.4.1
    Connection: keep-alive
    Upgrade-Insecure-Requests: 1
    User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,
    /*;q=0.8
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4

    0,CLOSED
    0,CONNECT

    +IPD,0,399:GET /IDN? HTTP/1.1
    Host: 192.168.4.1
    Connection: keep-alive
    Upgrade-Insecure-Requests: 1
    User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,
    /*;q=0.8
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4

    0,CLOSED
    0,CONNECT
    1,CONNECT

    [code]
    void loop() {

    static WifiConnection *connections;

    // check connections if the ESP8266 is there
    if (wifi_started)
    wifi.checkConnections(&connections);

    // check for messages if there is a connection
    for (int i = 0; i < MAX_CONNECTIONS; i++) {
    if (connections[i].connected) {
    // See if there is a message
    Serial.print(i);
    Serial.println(“-connected”);
    WifiMessage msg = wifi.getIncomingMessage();
    // Check message is there
    if (msg.hasData) {
    // process the command
    processCommand(msg);
    }
    }
    }
    …..
    void processCommand(WifiMessage msg) {
    Serial.println(“fn:processCommand”);
    // return buffer
    char espBuf[MSG_BUFFER_MAX];
    // scanf holders
    int set;
    char str[16];

    // Get command and setting
    sscanf(msg.message,”%15s %d”,str,&set);
    /* swSerial.print(str);/
    /
    swSerial.println(set);*/

    if ( !strcmp_P(str,IDN) ) {
    wifi.send(msg.channel,”ESP8266wifi Example”);
    }
    // Reset system by temp enable watchdog
    else if ( !strcmp_P(str,RST) ) {
    wifi.send(msg.channel,”SYSTEM RESET…”);
    // soft reset by reseting PC
    asm volatile (” jmp 0″);
    }
    // Unknown command
    else {
    wifi.send(msg.channel,”ERR”);
    }
    }
    [endcode]

  2. I guess connections[i].connected never became true

    // new connection
    if (ret == 1) {
    _connections[ch-0x30].connected = true;

  3. Hi Dmitri,

    I am not actually the creator of the library, only a contributor. The best way to get support for an open source library is to post an issue on the issue log: https://github.com/ekstrand/ESP8266wifi/issues This means everyone can assist and when an answer is provided others can see the solution.

    At first glance the message is being clipped. HTML responses are large due to the header (shown in your response). The library was not designed for ‘GET’ requests but for sending data packets. If you are not able to understand how to increase the buffer size, I would suggest finding an alternative library, more suited to REST data.

    Thanks,
    John.

Comments are closed.