refactor: Improve style and code for log controller

This commit is contained in:
Andrea Busi
2021-03-11 20:21:51 +01:00
parent e9b0343be7
commit c00a29a222
6 changed files with 73 additions and 95 deletions
@@ -232,7 +232,7 @@
if (!self.calibrazione) {
if (!self.inCalibrazione) {
if(timer > TEMPO_LATENZA_CALIBRAZIONE){
[[NSNotificationCenter defaultCenter] postNotificationName:@"AGGIORNA_LOG" object:nil userInfo:@{@"messaggio": @"Avvio Calibrazione"}];
[[NSNotificationCenter defaultCenter] postNotificationName:EQNDebugLogWillUpdateNotification object:nil userInfo:@{@"messaggio": @"Avvio Calibrazione"}];
NSLog(@"Avvio Calibrazione");
self.inCalibrazione = YES;
@@ -267,7 +267,7 @@
withObject:nil
waitUntilDone:YES];
[[NSNotificationCenter defaultCenter] postNotificationName:@"AGGIORNA_LOG" object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"Media %f stato %li", cal.media, (long)cal.stato ]}];
[[NSNotificationCenter defaultCenter] postNotificationName:EQNDebugLogWillUpdateNotification object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"Media %f stato %li", cal.media, (long)cal.stato ]}];
if (self.calibrazione.stato == nonCalibrato){
@@ -303,7 +303,7 @@
NSLog(@"Rilevamento data %@ stato %li deviaizone %f ", ril.timestamp, (long)ril.rilievo, ril.deviazione);
[[NSNotificationCenter defaultCenter] postNotificationName:@"AGGIORNA_LOG" object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"Rilevamento data %@ stato %li deviaizone %f deviazione calibrazione %f", ril.timestamp, (long)ril.rilievo, ril.deviazione, self.calibrazione.deviazione]}];
[[NSNotificationCenter defaultCenter] postNotificationName:EQNDebugLogWillUpdateNotification object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"Rilevamento data %@ stato %li deviaizone %f deviazione calibrazione %f", ril.timestamp, (long)ril.rilievo, ril.deviazione, self.calibrazione.deviazione]}];
if (ril == NULL){
[self performSelectorOnMainThread:@selector(avviaCalibrazione)
@@ -353,10 +353,10 @@
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[EQNGeneratoreURLServer urlMessagioStatoSmartPhone:anCalibrazione rilevamento:anRilevamento] richiesta:tipo success:^(id result) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"AGGIORNA_LOG" object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"invio informazione al server tipo %ld inviato ", (long)tipo]}];
[[NSNotificationCenter defaultCenter] postNotificationName:EQNDebugLogWillUpdateNotification object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"invio informazione al server tipo %ld inviato ", (long)tipo]}];
} failure:^(NSError *error) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"AGGIORNA_LOG" object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"invio informazione al server tipo %ld fallito ", (long)tipo]}];
[[NSNotificationCenter defaultCenter] postNotificationName:EQNDebugLogWillUpdateNotification object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"invio informazione al server tipo %ld fallito ", (long)tipo]}];
}];
}