Esempio n. 1
0
        // SetStandardUserSystemClockAutomaticCorrectionEnabled(b8)
        public ResultCode SetStandardUserSystemClockAutomaticCorrectionEnabled(ServiceCtx context)
        {
            SteadyClockCore             steadyClock = _timeManager.StandardSteadyClock;
            StandardUserSystemClockCore userClock   = _timeManager.StandardUserSystemClock;

            if (!userClock.IsInitialized() || !steadyClock.IsInitialized())
            {
                return(ResultCode.UninitializedClock);
            }

            if ((_permissions & TimePermissions.UserSystemClockWritableMask) == 0)
            {
                return(ResultCode.PermissionDenied);
            }

            bool autoCorrectionEnabled = context.RequestData.ReadBoolean();

            ITickSource tickSource = context.Device.System.TickSource;

            ResultCode result = userClock.SetAutomaticCorrectionEnabled(tickSource, autoCorrectionEnabled);

            if (result == ResultCode.Success)
            {
                _timeManager.SharedMemory.SetAutomaticCorrectionEnabled(autoCorrectionEnabled);

                SteadyClockTimePoint currentTimePoint = userClock.GetSteadyClockCore().GetCurrentTimePoint(tickSource);

                userClock.SetAutomaticCorrectionUpdatedTime(currentTimePoint);
                userClock.SignalAutomaticCorrectionEvent();
            }

            return(result);
        }
Esempio n. 2
0
        [CommandHipc(201)] // 6.0.0+
        // GetStandardUserSystemClockAutomaticCorrectionUpdatedTime() -> nn::time::SteadyClockTimePoint
        public ResultCode GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(ServiceCtx context)
        {
            StandardUserSystemClockCore userClock = _timeManager.StandardUserSystemClock;

            if (!userClock.IsInitialized())
            {
                return(ResultCode.UninitializedClock);
            }

            context.ResponseData.WriteStruct(userClock.GetAutomaticCorrectionUpdatedTime());

            return(ResultCode.Success);
        }
Esempio n. 3
0
        // IsStandardUserSystemClockAutomaticCorrectionEnabled() -> bool
        public ResultCode IsStandardUserSystemClockAutomaticCorrectionEnabled(ServiceCtx context)
        {
            StandardUserSystemClockCore userClock = _timeManager.StandardUserSystemClock;

            if (!userClock.IsInitialized())
            {
                return(ResultCode.UninitializedClock);
            }

            context.ResponseData.Write(userClock.IsAutomaticCorrectionEnabled());

            return(ResultCode.Success);
        }