HI.
I have a problem, please help.
updateControls() in LightControlFragmenin class in "CSRmesh Control Application v1.3 for Android" can't update control properly
Here is a strange code. the part of LightControlFragment class. I did not fix anything.
-----------------------------------------------------------------------------------------------------
protected void updateControls(int selectedDeviceId) {
Device dev = mController.getDevice(selectedDeviceId); if (dev != null) { LightState state = (LightState)dev.getState(StateType.LIGHT); PowState powState = (PowState)dev.getState(StateType.POWER); // Set UI to reflect the selected light's state if the state is valid. mEnableEvents = false; mEnablePowerSwitchEvent = false; mPowerSwitch.setChecked(powState.getPowerState() == PowerState.ON); mEnablePowerSwitchEvent = true; if (state.isStateKnown()) { int r = (int) state.getRed() & 0xFF; int g = (int) state.getGreen() & 0xFF; int b = (int) state.getBlue() & 0xFF; float[] hsv = new float[3]; Color.RGBToHSV(r, g, b, hsv); mColorWheel.setCursor(hsv[0], hsv[1]); mBrightSlider.setProgress((int) (hsv[2] * 100.0f)); mCurrentColor = Color.rgb(r, g, b); mColorWheel.invalidate(); } else { mColorWheel.setCursor(0, 0); mColorWheel.invalidate(); } mEnableEvents = true; } else { mEnableEvents = false; mBrightSlider.setProgress(100); mEnableEvents = true; } }
-----------------------------------------------------------------------------------------------------
state.getRed(), state.getGreen(), state.getBlue() and powState.getPowerState() always return 0, whatever the light state is.
and thus updateControls() function can't update controls properly.
this is my situation. I am seeing this link https://wiki.csr.com/wiki/CSRmesh.
I have a CSRmesh development kit
I am working with "CSRMeshLight" in CSRmesh v1.3 - Libraries (56025_CSRmesh-1.3-Examples-Applications_icp)
and Android Application (CSRmesh Control Application v1.3 for Android)
"CSRMeshLight" in CSRmesh v1.3 - Libraries is compiled with CSR xIDE and download to development kit succesfully.
and android Application is installed on Android phone (SM-N910S, Android v6.0) succesfully.
The problem is..
getState() returns LightState(or PowState) type casted data(state or powState) with Insignificant data in it
and powState.getPowerState(), state.getRed(), state.getGreen() and state.getBlue() always return 0, each time updateControls called.
There is some explanation about getState() in API documentation (in 55945_CSRmesh-1.3-Android-Application_icp/doc)
Class LightModelApi
getState(int deviceId)
When i saw the that explanation. I thought,
if Android App request the "DATA about state of light" to NODE at first, then it will be transfered from NODE to Android App over the air.
but actually nothing is transfered over the air when getState() is called. nothing is happend.
help me. Please tell me what is wrong..