You call self-> in this function so much that I think is worthwhile creating a void OnPlatformStateChanged() member function in PowerContext, so code is clearer. The current function would just call the member one.