----------------------------------------------------------------------------- Request current state from the device -----------------------------------------------------------------------------
| 137 | // Request current state from the device |
| 138 | //----------------------------------------------------------------------------- |
| 139 | bool Color::RequestState |
| 140 | ( |
| 141 | uint32 const _requestFlags, |
| 142 | uint8 const _instance, |
| 143 | Driver::MsgQueue const _queue |
| 144 | ) |
| 145 | { |
| 146 | bool requests = false; |
| 147 | if( ( _requestFlags & RequestFlag_Static ) && HasStaticRequest( StaticRequest_Values ) ) |
| 148 | { |
| 149 | /* if we havn't got a valid capability from our Config File, then get what the device is capable of. If the user changes the Color Channels Value we use the stored version instead */ |
| 150 | if (m_dom.GetFlagShort(STATE_FLAG_COLOR_CHANNELS) == 0) { |
| 151 | Msg* msg = new Msg("ColorCmd_CapabilityGet", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId()); |
| 152 | msg->Append(GetNodeId()); |
| 153 | msg->Append(2); |
| 154 | msg->Append(GetCommandClassId()); |
| 155 | msg->Append(ColorCmd_Capability_Get); |
| 156 | msg->Append(GetDriver()->GetTransmitOptions()); |
| 157 | GetDriver()->SendMsg(msg, _queue); |
| 158 | } |
| 159 | return true; |
| 160 | } |
| 161 | if (_requestFlags & RequestFlag_Dynamic) |
| 162 | { |
| 163 | /* do a request for each channel. the RequestValue will filter out channels that are not supported |
| 164 | * by the device |
| 165 | */ |
| 166 | if (m_refreshinprogress == true) { |
| 167 | Log::Write(LogLevel_Info, GetNodeId(), "Color Refresh in progress"); |
| 168 | return false; |
| 169 | } |
| 170 | |
| 171 | /* if the device has the ColorIDX bug, then only request the first channel. We will get the rest later */ |
| 172 | for (int i = 0; i <= 9; i++) { |
| 173 | bool tmprequests = RequestColorChannelReport(i, _instance, _queue ); |
| 174 | if (tmprequests) |
| 175 | m_coloridxcount = i; |
| 176 | requests |= tmprequests; |
| 177 | if (m_com.GetFlagBool(COMPAT_FLAG_COLOR_IDXBUG) && tmprequests) { |
| 178 | m_refreshinprogress = true; |
| 179 | break; |
| 180 | } |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | return requests; |
| 185 | } |
| 186 | |
| 187 | //----------------------------------------------------------------------------- |
| 188 | // <Color::RequestValue> |
nothing calls this directly
no test coverage detected