microsoft / devkit-sdk

Arduino library and package for the MXChip IoT DevKit
https://aka.ms/devkit
MIT License
68 stars 57 forks source link

Base Client class support is missing #1038

Closed baqwas closed 4 years ago

baqwas commented 4 years ago

I'm trying to use the following code snippet:

#include <AZ3166WiFi.h>       // https://github.com/microsoft/devkit-sdk/tree/master/AZ3166/src/libraries/WiFi/src
#include <AZ3166WiFiClient.h> // https://github.com/microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/WiFi/src/AZ3166WiFiClient.h
#include "IoT_DevKit_HW.h"    // https://github.com/microsoft/devkit-sdk/blob/master/AZ3166/src/libraries/Sensors/src/IoT_DevKit_HW.h
#include <MySQL_Connection.h> // https://github.com/ChuckBell/MySQL_Connector_Arduino/blob/master/src/MySQL_Connection.h
...
WiFiClient WiFi_client;           // app will rely on Wi-Fi rather than serial line
MySQL_Connection db_conn((Client *)&WiFi_client);

Unfortunately, the compiler cannot find any type definition for Client (see last line above). Is there any equivalent way to cast this type? EthernetClient was not accepted by the compiler. I cannot find any reference example to Client class except to understand that it does not have to be used explicitly. There are classes that inherit this base class implicitly.

I do not need to connect to Azure. There is a local SQL instance that I can connect to with the same basic line of code (without AZ3166 libraries but standard Arduino libraries work fine). Again, no need for connection to Azure, just need local Arduino connectivity with AZ3166. MQTT works fine (haven't dug into the code to understand the instantiation of the client entity there but will do so later).

Is there an alternate way to connect to an intranet instance of SQL Server (e.g. MySQL or MariaDB) with AZ3166 libraries? Thanks.

Kind regards.

JerryYangKai commented 4 years ago

Hi, connecting to a local SQL instance is not supported in DevKit sdk. So I suggest you can ask MySQL_Connector_Arduino repo for some help.