Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to explicitly set MCS controller data channel value #21

Closed
pablosun opened this issue May 25, 2017 · 1 comment
Closed

Allow users to explicitly set MCS controller data channel value #21

pablosun opened this issue May 25, 2017 · 1 comment
Assignees

Comments

@pablosun
Copy link
Contributor

pablosun commented May 25, 2017

Currently, the MCS controller data channel, such as MCSControllerOnOff does not provide set() to update the data channel value. In some scenarios, such as synchronizing a physical switch with its network counterparts, we need to change the value in MCS from Arduino side.

This feature request is adding a new set() method to all the MCSController classes.

@pablosun pablosun self-assigned this May 25, 2017
pablosun added a commit that referenced this issue May 31, 2017
We create a template base class MCSControllerBase and let all controller classes inherit the base class. The child classes overrides the string - value conversion routines.

Note that GPS and PWM controllers require more work to properly define the value class.
pablosun added a commit that referenced this issue Jun 1, 2017
…ntrollerGPS

The value() of PWM/GPS controller channels are now changed to MCSPWMValue and MCSGPSValue accordingly.
We provide extra helper methods such as MCSControllerPWM::dutyCycle() and MCSControllerGPS::altitude() to users to easily access the fields in the value.
pablosun added a commit that referenced this issue Jun 1, 2017
We should keep the behavior of the original LED_control example.
pablosun added a commit that referenced this issue Jun 1, 2017
## New features

 * As requested in #21, Provide new method `setServerValue(value)` for all controller data channels. Developers may use this method to update the MCS/MCSLite server-side values. Once the value is successfully set, the channel becomes both `valid()` and `updated()`.

## Changes

 * `MCSGPSController` now have a new method `value()` which returns an `MCSGPSValue` object that is a struct of latitude, longitude and altitude. The exisiting methods such as `latitude()` are left unchanged.
 * `MCSPWMController::value()` has changed:
    * It now returns a `MCSPWMValue` object instead of the **duty cycle** field.
    * A new method `dutyCycle()` is added to retrieve the field seperately.
 * All controller channels are now inherited from a `MCSControllerBase<T>` template class that provides a common implementat for `value()`, `setServerValue()` and `_update()` logics. This reduces some redundant code implementations. Note that **display channels** are left unchanged.
@pablosun
Copy link
Contributor Author

pablosun commented Jun 1, 2017

Will be available after v0.7.11

@pablosun pablosun closed this as completed Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant