Hi all.
I am trying to use a lilygo-T-SIM7080G to send an image to an FTP server over NB-iot, taken with a OV2640.
The main roadblock I have is sending an image to the modem, as there are no examples for using file management in the repository for the device. Also TinyGSM library has no file management examples.
I can't really find any examples of anyone doing this in any language, so I guess it really is a bit of a niche problem.
The most difficult point is streaming the image to the modem. Here is my extremely basic, but nonfunctional attempt. I'm not entirely sure why it doesn't work.
modem.sendAT("+CFSINIT"); //ready modem to rcv file
modem.waitResponse();
modem.sendAT("+CFSWFILE=0,\"image\",1,4096,9999"); //send filesize info
modem.waitResponse();
std::ifstream file("image.png", std::ios::binary);
if (!file.is_open()) {
std::cerr << "Failed to open file." << std::endl;
return;
}
Serial.println("Read the image file into a buffer");
std::vector<char> buffer(std::istreambuf_iterator<char>(file), {});
Serial.println("Convert the buffer to a string");
std::string str(buffer.begin(), buffer.end());
Serial.println("Send the string to modem.sendAT()");
const char* c_str = str.c_str();
modem.stream.write(c_str);
modem.waitResponse();
modem.sendAT("+CFSGFIS=?");
modem.waitResponse();