----------------------------------------------------------------------------- Send the next block of replication data -----------------------------------------------------------------------------
| 224 | // Send the next block of replication data |
| 225 | //----------------------------------------------------------------------------- |
| 226 | void ControllerReplication::SendNextData |
| 227 | ( |
| 228 | ) |
| 229 | { |
| 230 | uint16 i = 255; |
| 231 | |
| 232 | if( !m_busy ) |
| 233 | { |
| 234 | return; |
| 235 | } |
| 236 | |
| 237 | while( 1 ) |
| 238 | { |
| 239 | if( m_groupIdx != -1 ) |
| 240 | { |
| 241 | m_groupIdx++; |
| 242 | if( m_groupIdx <= m_groupCount ) |
| 243 | { |
| 244 | break; |
| 245 | } |
| 246 | } |
| 247 | i = m_nodeId == -1 ? 0 : m_nodeId+1; |
| 248 | LockGuard LG(GetDriver()->m_nodeMutex); |
| 249 | while( i < 256 ) |
| 250 | { |
| 251 | if( GetDriver()->m_nodes[i] ) |
| 252 | { |
| 253 | m_groupCount = GetDriver()->m_nodes[i]->GetNumGroups(); |
| 254 | if( m_groupCount != 0 ) |
| 255 | { |
| 256 | m_groupName = GetDriver()->m_nodes[i]->GetGroupLabel( m_groupIdx ); |
| 257 | m_groupIdx = m_groupName.length() > 0 ? 0 : 1; |
| 258 | break; |
| 259 | } |
| 260 | } |
| 261 | i++; |
| 262 | } |
| 263 | m_nodeId = i; |
| 264 | break; |
| 265 | } |
| 266 | if( i < 255 ) |
| 267 | { |
| 268 | Msg* msg = new Msg( (m_groupName.length() > 0 ? "ControllerReplicationCmd_TransferGroupName" : "ControllerReplicationCmd_TransferGroup"), m_targetNodeId, REQUEST, FUNC_ID_ZW_REPLICATION_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() ); |
| 269 | msg->Append( m_targetNodeId ); |
| 270 | if( m_groupName.length() > 0 ) |
| 271 | { |
| 272 | msg->Append((uint8) (m_groupName.length() + 4 )); |
| 273 | msg->Append( GetCommandClassId() ); |
| 274 | msg->Append( ControllerReplicationCmd_TransferGroupName ); |
| 275 | msg->Append( 0 ); |
| 276 | msg->Append( m_groupIdx ); |
| 277 | for( uint8 j = 0; j < m_groupName.length(); j++ ) |
| 278 | { |
| 279 | msg->Append( m_groupName[j] ); |
| 280 | } |
| 281 | m_groupName = ""; |
| 282 | } |
| 283 | else |
no test coverage detected