This library can be included in your IoT projects to define Service const used to extract service name and cathegory to pass to the approver function.
Based on these values, approver is able to grant or not access to the miniservice required.
Constants starting with the prefix "SVC" represents service value definition. Staring with the prefix "CTH" represents the SET of the services.
Unfortunatelly not all boards accept the same object modules so we have been forced to create two different versions of the same library. The
first version is used with the NodeMCu board while the second one (The one described here) is used
togheter with the ESP module and the wifiesp library. You will find both in the
Download area
In the library you will have available also some functions that you can use to communicate directly with Miniservice platform.
For any Miniservice the activation process requires a call to authenticate the service and a call to pass the request to the server. Using this library you will simplify the development process.
//This is the constructor of the class
MiniService(String Obj, String IP);
//This is the function to request the authentication. It returns a valid token if the appliance has been authorised
String BVAuthenticate(String SVCCode);
//This is the function you can use to send Biomedical values to the Miniservice infrastructure (It requires a valid token and to be authorised to use Medical cath functions)
bool SendBioMedicalValues(String Token, int Temp, int Beat, int Oxy);
The following code can be used to create an approval string (to be used by the IoT device) passing the value related to the Temperature functions (SVCTemperature).
MiniService HealtService(ObjectCode, LocalIP);
BVReturnString = HealtService.BVAuthenticate(HealtService.SVCBiomedical);
Serial.println(BVReturnString); //Print the response payload
Token = xmlTakeParam(BVReturnString, "Message");
if ((Token != "Not Authorized") && (Token != "not found")) {
//Send the Meteo Values
HealtService.SendBioMedicalValues(Token, 0 ,heartRate, spo2);
}