Sming icon indicating copy to clipboard operation
Sming copied to clipboard

AtClient sample

Open Evgsurf opened this issue 5 years ago • 4 comments

Hello, is some sample for ATClient ? I did not find .

Evgsurf avatar Nov 20 '18 05:11 Evgsurf

There is no AtClient sample but you are free to add one. From other projects I can give you the following code (incomplete and without any warranty) samples

void a6Callback(AtClient& client, Stream& source, char arrivedChar,
                uint16_t availableCharsCount)
{
    // Do something useful here...
}

void a20_example()
{
    AtClient modem(&Serial);
    modem.send("ATE0");
    modem.send("AT+CAMSTART");

    modem.send(
        "AT+CAMCAP\r", "+CAMCAP:",
        (AtCallback)([&](AtClient& client, Stream& source, char arrivedChar,
                         uint16_t availableCharsCount) {
            printf("Ch: 0x%x, Av: %d\n", arrivedChar, availableCharsCount);
        }),
        NULL, 4000);

    AtCommand command;
    command.name = "AT+CAMRD\r";
    command.breakOnError = false;
    command.callback = a6Callback;
    modem.send(command);
   // ...
}

I have a PhotoBooth project which is gathering dust for quite some time. When I find the time I can try to revive it and add it here as a sample or as an application based on Sming Framework,

slaff avatar Nov 20 '18 10:11 slaff

@slaff BTW your code is not Sming, because AtCommand struct has not fields callback and name ...

Evgsurf avatar Nov 20 '18 14:11 Evgsurf

Just check the code inside https://github.com/SmingHub/Sming/blob/6af154606a66361f999bc37549c9993e2dec0174/Sming/SmingCore/AtClient.cpp#L78 .

I guess my example code is too old. As I said - no warranty :)

slaff avatar Nov 20 '18 14:11 slaff

@slaff The world has not any warranty! I try to modify code, but looks like my modem neoway 590 is die. I need to get new one ....

Evgsurf avatar Nov 20 '18 14:11 Evgsurf