onSubscrStateChanged method
Handle library event raised when received NOTIFY request
Implementation
void onSubscrStateChanged(int subscrId, SubscriptionState s, String resp) {
_logs?.print('onSubscrStateChanged subscrId:$subscrId resp:$resp ${s.toString()}');
//Find subscription by id
int idx = _subscriptions.indexWhere((sub) => (sub.mySubscrId == subscrId));
if(idx == -1) return;
if(s == SubscriptionState.destroyed) {
//Remove destroyed subscription from list
_logs?.print('Deleted subscription subscrId:$subscrId');
_subscriptions.removeAt(idx);
notifyListeners();
_raiseSaveChanges();
}else{
//Update state of the found subscription
_subscriptions[idx].onSubscrStateChanged(s, resp);
}
}