diff --git a/MConnectSDK/MConnectClient.cs b/MConnectSDK/MConnectClient.cs
index a89026c..e13ab8f 100644
--- a/MConnectSDK/MConnectClient.cs
+++ b/MConnectSDK/MConnectClient.cs
@@ -15,62 +15,62 @@ namespace MConnectSDK
{
///
/// Client per connessione a MaestroConnect
- ///
+ /// {ext}
public class MConnectClient
{
#region oggetti base ed init
///
/// Oggetto accesso memoria...
- ///
+ /// {ext}
protected memLayer ML;
///
/// Parametri di comunicazione attivi
- ///
+ /// {ext}
protected confParam _currParam;
///
/// ID univoco dell'HMI per piattaforma MaestroConnect
- ///
+ /// {ext}
protected string MachineID;
///
/// ID applicativo/client per piattaforma MaestroConnect (differente per UTE)
- ///
+ /// {ext}
protected string ClientID;
///
/// Determina se il server redis sia attivo e connesso (check periodico...)
- ///
+ /// {ext}
public bool redServAlive;
///
/// DataOra ultimo controllo stato server REDIS
- ///
+ /// {ext}
protected DateTime lastRedSrvCheck;
///
/// Intervallo di default x recall successive
- ///
+ /// {ext}
protected int waitRecall = 1000;
///
/// URL x chiamata auth WebApp / QR-code da YAML...
- ///
+ /// {ext}
protected string WebAppUrl = @"https://smart.maestroconnect.com/deviceauth?user_code={0}&machineID={1}";
///
/// URL BASE per le chiamate
- ///
+ /// {ext}
protected string BaseUrl = @"https://stg.maestroconnect.scmgroup.com/";
///
/// URL BASE per le chiamate upload
- ///
+ /// {ext}
protected string UploadUrl = @"https://stg.maestroconnect.scmgroup.com/storage-api/backups";
///
/// URL BASE per le chiamate
- ///
+ /// {ext}
protected string PingTarget = @"stg.maestroconnect.scmgroup.com";
///
/// URL per test HEALT del cloud
- ///
+ /// {ext}
protected string AliveTarget = @"https://stg.api.maestroconnect.scmgroup.com/health";
///
/// DateTime di watchdog
- ///
+ /// {ext}
protected DateTime watchDog
{
get
@@ -92,11 +92,11 @@ namespace MConnectSDK
}
///
/// TTL lungo in REDIS (10 min)
- ///
+ /// {ext}
protected int longTTL = 600;
///
/// Stato della richiesta attuale tornato
- ///
+ /// {ext}
protected Result reqStatus
{
get
@@ -118,7 +118,7 @@ namespace MConnectSDK
}
///
/// Ultima response controllo enroll
- ///
+ /// {ext}
protected enrollResponse enrollResp
{
get
@@ -143,7 +143,7 @@ namespace MConnectSDK
}
///
/// Ultima response elenco utenti
- ///
+ /// {ext}
protected userListResponse usrListResp
{
get
@@ -168,7 +168,7 @@ namespace MConnectSDK
}
///
/// Ultimo token response ottenuto (e salvato in REDIS)
- ///
+ /// {ext}
protected tokenResponse tokResp
{
get
@@ -193,7 +193,7 @@ namespace MConnectSDK
}
///
/// Verifica se sia necessario rigenerare il token...
- ///
+ /// {ext}
protected bool tokenDone
{
get
@@ -209,7 +209,7 @@ namespace MConnectSDK
}
///
/// Risposta della chiamata di verifica
- ///
+ /// {ext}
protected verificationSuccessResponse verifResp
{
get
@@ -231,7 +231,7 @@ namespace MConnectSDK
}
///
/// Risposta della chiamata di clientInfo
- ///
+ /// {ext}
protected clientInfoResponse clientInfoResp
{
get
@@ -253,7 +253,7 @@ namespace MConnectSDK
}
///
/// Verifica se sia necessario rifare la fase di verifica x i token di auth...
- ///
+ /// {ext}
protected bool verificationDone
{
get
@@ -269,7 +269,7 @@ namespace MConnectSDK
}
///
/// AccessToken
- ///
+ /// {ext}
protected string access_token
{
get
@@ -281,7 +281,7 @@ namespace MConnectSDK
}
///
/// RefreshToken
- ///
+ /// {ext}
protected string refresh_token
{
get
@@ -293,7 +293,7 @@ namespace MConnectSDK
}
///
/// DateTime di enroll (se futuro = NON enrolled)
- ///
+ /// {ext}
protected DateTime enrollDate
{
get
@@ -315,7 +315,7 @@ namespace MConnectSDK
}
///
/// Elenco utenti (in cache locale)
- ///
+ /// {ext}
protected List userListCache
{
get
@@ -338,7 +338,7 @@ namespace MConnectSDK
}
///
/// Utente corrente (SE login OK)
- ///
+ /// {ext}
protected UserData currUser
{
get
@@ -361,7 +361,7 @@ namespace MConnectSDK
}
///
/// Elenco utenti (in cache locale)
- ///
+ /// {ext}
protected List userPwdLocalCache
{
get
@@ -389,7 +389,7 @@ namespace MConnectSDK
///
/// URL pagina per check enroll (parametrico)
- ///
+ /// {ext}
protected string pageUrlCheckEnroll
{
get
@@ -403,7 +403,7 @@ namespace MConnectSDK
///
/// URL pagina per Download Immagini ( https://firebasestorage.googleapis.com/v0/b/scm-mconnect.appspot.com/o/ )
- ///
+ /// {ext}
protected string pageUrlImgDownload
{
get
@@ -414,8 +414,8 @@ namespace MConnectSDK
///
/// Effettua test preliminare stato...
- ///
- ///
+ /// {ext}
+ /// {ext}
private Result preCheckStatus()
{
Result answ = new Result()
@@ -464,7 +464,7 @@ namespace MConnectSDK
}
///
/// Controlla stato server alive
- ///
+ /// {ext}
private bool checkRedisAlive()
{
bool newStatus = ML.connRedis.IsConnected;
@@ -484,7 +484,7 @@ namespace MConnectSDK
}
///
/// Aggiorna stato redis server + invio dati pending
- ///
+ /// {ext}
private void setWatchdog()
{
// verifico eventuali invii pending... SE connesso...
@@ -496,7 +496,7 @@ namespace MConnectSDK
}
///
/// Effettua lo step 1 di chiamata x ottenere il TOKEN iniziale
- ///
+ /// {ext}
private void doTokenStep()
{
// parametri chiamata
@@ -514,7 +514,7 @@ namespace MConnectSDK
}
///
/// Effetuo step 3: /verification
- ///
+ /// {ext}
private bool doVerificationStep()
{
bool answ = false;
@@ -565,7 +565,7 @@ namespace MConnectSDK
///
/// Inizializzazione classe specificando il file di conf con i parametri
- ///
+ /// {ext}
public MConnectClient()
{
@@ -574,8 +574,8 @@ namespace MConnectSDK
}
///
/// Parsing file di configurazione
- ///
- ///
+ /// {ext}
+ /// {ext}
private void parseConfFile(string confFilePath)
{
confParam param = new confParam();
@@ -626,7 +626,7 @@ namespace MConnectSDK
}
///
/// Forza svuotamento di TUTTI i dati in REDIS
- ///
+ /// {ext}
public void forceRedisFlush()
{
// svuoto TUTTI i dati x INIT...
@@ -634,11 +634,11 @@ namespace MConnectSDK
}
///
/// Metodo di INIT della classe di comunicazione
- ///
- ///
- /// Token, che può benissimo essere CancellationToken.None
- ///
- ///
+ /// {ext}
+ /// {ext}
+ /// Token, che può benissimo essere CancellationToken.None{ext}
+ /// {ext}
+ /// {ext}
public async Task InitSDKAsync(string confFilePath, CancellationToken token, IProgress progress = null)
{
// controlloare file di conf se valido... = "mconnect.conf.yaml"
@@ -656,8 +656,8 @@ namespace MConnectSDK
}
///
/// Recupera status del client
- ///
- ///
+ /// {ext}
+ /// {ext}
public async Task GetClientStatusAsync()
{
var currReq = reqStatus;
@@ -709,8 +709,8 @@ namespace MConnectSDK
}
///
/// Fa un controllo sulla risposta, eventualmente rinnova il token di accesso restituendo SE HA FATTO refresh (quindi serve nuova chiamata)
- ///
- ///
+ /// {ext}
+ /// {ext}
private bool checkFixToken(string rawResult)
{
bool answ = false;
@@ -736,7 +736,7 @@ namespace MConnectSDK
///
/// Effettua una chaimata alla funzione di refresh del token di comunicazione
- ///
+ /// {ext}
private void refreshAuthToken()
{
// parametri chiamata
@@ -756,10 +756,10 @@ namespace MConnectSDK
///
/// Recupera status del client
- ///
- /// Token, che può benissimo essere CancellationToken.None
- ///
- ///
+ /// {ext}
+ /// Token, che può benissimo essere CancellationToken.None{ext}
+ /// {ext}
+ /// {ext}
public async Task GetClientStatusAsync(CancellationToken token, IProgress progress = null)
{
await Task.Run(() =>
@@ -789,8 +789,8 @@ namespace MConnectSDK
}
///
/// Tentativo AUTH
- ///
- ///
+ /// {ext}
+ /// {ext}
public ActivationPayload tryAuthorize()
{
// init output
@@ -838,9 +838,9 @@ namespace MConnectSDK
}
///
/// Effettua vera chiamata enroll
- ///
- ///
- ///
+ /// {ext}
+ /// {ext}
+ /// {ext}
public string doEnroll()
{
string answ = "";
@@ -855,7 +855,7 @@ namespace MConnectSDK
}
///
/// Effettua verifica enroll (chiamando organization + machineID)
- ///
+ /// {ext}
protected bool checkEnroll()
{
bool answ = false;
@@ -885,8 +885,8 @@ namespace MConnectSDK
}
///
/// Tentativo ENROLL
- ///
- ///
+ /// {ext}
+ /// {ext}
public ActivationPayload tryEnroll()
{
// init output
@@ -940,8 +940,8 @@ namespace MConnectSDK
///
/// Metodo x ottenere update richiesta
- ///
- ///
+ /// {ext}
+ /// {ext}
public Result reqStatusUpd
{
get
@@ -952,7 +952,7 @@ namespace MConnectSDK
}
///
/// Restituisce codice organizzazione
- ///
+ /// {ext}
public string organizationCode
{
get
@@ -969,9 +969,9 @@ namespace MConnectSDK
}
///
/// Recupera elenco user x organizzazione corrente
- ///
- /// Indica se scaricare ANCHE TUTTE le immagini degli utenti (default = false)
- ///
+ /// {ext}
+ /// Indica se scaricare ANCHE TUTTE le immagini degli utenti (default = false){ext}
+ /// {ext}
public async Task getUserListAsync(bool getImages = false)
{
var _currStatus = reqStatus;
@@ -992,9 +992,9 @@ namespace MConnectSDK
}
///
/// Elenco utenti da MaestroConnect
- ///
- /// Indica se scaricare ANCHE TUTTE le immagini degli utenti (default = false)
- ///
+ /// {ext}
+ /// Indica se scaricare ANCHE TUTTE le immagini degli utenti (default = false){ext}
+ /// {ext}
private List userListMConnect(bool getImages = false)
{
List answ = new List();
@@ -1067,8 +1067,8 @@ namespace MConnectSDK
///
/// Recupera elenco user di Maestro connect registrati come CREATI sul client/HMI x organizzazione corrente
- ///
- ///
+ /// {ext}
+ /// {ext}
public async Task getUserImportedListAsync()
{
var _currStatus = reqStatus;
@@ -1099,11 +1099,11 @@ namespace MConnectSDK
///
/// Imposta UN SINGOLO utente come importato () o eliminato(false)
- ///
- /// CHI invia la richeista (x decidere come impostare status), HMI = LOCAL
- ///
- /// true=importato / false = cancellato/non + importato
- ///
+ /// {ext}
+ /// CHI invia la richeista (x decidere come impostare status), HMI = LOCAL{ext}
+ /// {ext}
+ /// true=importato / false = cancellato/non + importato{ext}
+ /// {ext}
public async Task setUserImported(SourceType sender, string username, bool imported = true)
{
var _currStatus = reqStatus;
@@ -1172,10 +1172,10 @@ namespace MConnectSDK
///
/// Effettua login e restituisce dati utente
- ///
- ///
- ///
- ///
+ /// {ext}
+ /// {ext}
+ /// {ext}
+ /// {ext}
public async Task TryUserLogin(string username, string password)
{
var _currStatus = reqStatus;
@@ -1379,8 +1379,8 @@ namespace MConnectSDK
///
/// Effettua update userList
- /// Indica se scaricare ANCHE TUTTE le immagini degli utenti (default = false)
- ///
+ /// Indica se scaricare ANCHE TUTTE le immagini degli utenti (default = false){ext}
+ /// {ext}
private void updateUserListCacheFromCloud(bool getImages = false)
{
// se NON modalità testing LEGGO davvero da cloud la NUOVA lista
@@ -1391,10 +1391,10 @@ namespace MConnectSDK
///
/// Generazione HASH password salted
- ///
- ///
- ///
- ///
+ /// {ext}
+ /// {ext}
+ /// {ext}
+ /// {ext}
protected string GenerateSaltedHash(string _plainText, string _salt)
{
byte[] plainText = Encoding.ASCII.GetBytes(_plainText);
@@ -1419,10 +1419,10 @@ namespace MConnectSDK
///
/// Task x AUTH
- ///
- ///
- ///
- ///
+ /// {ext}
+ /// {ext}
+ /// {ext}
+ /// {ext}
public async Task TryActivationAsync(CancellationToken token, IProgress progress)
{
// predispongo il payload da allegare alla result...
@@ -1479,10 +1479,10 @@ namespace MConnectSDK
}
///
/// Task x AUTH
- ///
- ///
- ///
- ///
+ /// {ext}
+ /// {ext}
+ /// {ext}
+ /// {ext}
public async Task EnrollMachineAsync(CancellationToken token, IProgress progress)
{
// predispongo il payload da allegare alla result...
@@ -1539,7 +1539,17 @@ namespace MConnectSDK
// return finale dello status della chiamata...
return _currReq;
}
- public async Task TryUpLoadFile(CancellationToken token, IProgress progress, string fileName)
+
+
+ ///
+ /// Classe x caricamento files
+ /// {ext}
+ /// {ext}
+ /// {ext}
+ /// Nem file (PATH COMPLETO) da caricare{ext}
+ /// Nome da dare al file per il caricamento (con cui sarà nominato al download), se nullo/empty --> impostato BACKUP.{ext}
+ /// {ext}
+ public async Task TryUpLoadFile(CancellationToken token, IProgress progress, string fileName, string uploadName = "")
{
Result result = new Result();
@@ -1549,14 +1559,17 @@ namespace MConnectSDK
result.Payload = new FilePayload();
result.CallResultOk = false;
GatewayPayload resp = new GatewayPayload();
- string fileExt = Path.GetExtension(fileName);
- string nomeFile = string.Format("Backup{0}", fileExt);
+ if (uploadName == null || uploadName == "")
+ {
+ string fileExt = Path.GetExtension(fileName);
+ uploadName = string.Format("Backup{0}", fileExt);
+ }
try
{
byte[] fileBytes = File.ReadAllBytes(fileName);
// effettuo call EFFETTIVA
- var taskRes = Task.Run(() => Utils.uploadAsync(UploadUrl, nomeFile, fileBytes));
+ var taskRes = Task.Run(() => Utils.uploadAsync(UploadUrl, uploadName, fileBytes));
taskRes.Wait();
var rawResult = taskRes.Result;
// leggo la risposta in var temporanea...
diff --git a/TestClient/MainForm.cs b/TestClient/MainForm.cs
index ce0cbda..149a780 100644
--- a/TestClient/MainForm.cs
+++ b/TestClient/MainForm.cs
@@ -220,7 +220,7 @@ namespace TestClient
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(authData.QrCode, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
- Bitmap qrCodeImage = qrCode.GetGraphic(5);
+ Bitmap qrCodeImage = qrCode.GetGraphic(5);
pictBox.Image = qrCodeImage;
#if false