Fledge
An open source edge computing platform for industrial users
PIWebAPI Class Reference

The PIWebAPI class. More...

#include <piwebapi.h>

Public Member Functions

void setAuthMethod (std::string &authMethod)
 
void setAuthBasicCredentials (std::string &authBasicCredentials)
 
int GetVersion (const string &host, string &version, bool logMessage=true)
 Calls the PI Web API to retrieve the version. More...
 
string errorMessageHandler (const string &msg)
 Handles PI Web API error message considering the possible cases: More...
 

Detailed Description

The PIWebAPI class.

Member Function Documentation

◆ errorMessageHandler()

string PIWebAPI::errorMessageHandler ( const string &  msg)

Handles PI Web API error message considering the possible cases:

  • removes all the LF CR and extracts spaces
  • substitutes a message with a different one using an hardcoded vector
  • in the case of the presence of an HTTP code adds the corresponding text using the Simple-Web-Server functionalities
  • Handles PI Web API json error message extracting significant parts to produce a meaningful and concise message
Parameters
jsonJSON message generated by PIWebAPI containing the error
Returns
The concise and meaningful error message

◆ GetVersion()

int PIWebAPI::GetVersion ( const string &  host,
string &  version,
bool  logMessage = true 
)

Calls the PI Web API to retrieve the version.

Parameters
hostReference of the server running PI Web API in the format: hostName + ":" + port
versionThe returned version string of the PI Web API server
logMessageIf true, log an error message if there is a failure (default: true)
Returns
HTTP response status code

The documentation for this class was generated from the following files: