This project is read-only.
1
Vote

MD23Battery not working

description

I'm testing the libraries from Devantech and I'm noticing that MD23Battery never gets any Replace notification so never gets an updated value.
Analyzing the code I realized that MD23Battery is not subscribing to MD23Hardware notifications, comparing with other services I guess the start method is missing the subscription, it should be like this:
    protected override void Start()
    {
        // Configure default state
        if (_state == null)
        {
            _state = new genericbattery.BatteryState();
            _state.MaxBatteryPower = 12.0;
            _state.PercentCriticalBattery = 0.87; // guess
            base.SaveState(_state);
        }

        base.Start();

        SubscribeToMD23Hardware(); // This line is missing in the original libraries
    }
And actually it's:
    protected override void Start()
    {
        // Configure default state
        if (_state == null)
        {
            _state = new genericbattery.BatteryState();
            _state.MaxBatteryPower = 12.0;
            _state.PercentCriticalBattery = 0.87; // guess
            base.SaveState(_state);
        }

        base.Start();
    }
Am I correct?
Thanks
Paulo Ferro

comments