void frmScanforDevices::getNodeInfo( wxCommandEvent& event ) { CMDF mdf; wxString url; wxBusyCursor wait; scanElement *pElement = (scanElement *) m_DeviceTree->GetItemData(m_DeviceTree->GetSelection()); if (NULL != pElement) { wxProgressDialog progressDlg(_("Getting node info."), _("Reading Registers"), 256, this, wxPD_ELAPSED_TIME | wxPD_AUTO_HIDE | wxPD_CAN_ABORT); if (INTERFACE_CANAL == m_interfaceType) { if ( CANAL_ERROR_SUCCESS == m_csw.getDllInterface()->readRegistersfromLevel1Device( pElement->m_nodeid, 0x80, // strat reg 0, // page 128, // count pElement->m_reg + 0x80 ) ) { uint8_t preg_url[33]; memset( preg_url, 0, sizeof(preg_url)); memcpy( preg_url, pElement->m_reg + 0xe0, 32 ); bool bmdf = m_csw.loadMDF( this, preg_url, url, &mdf ); pElement->m_html = vscp_getDeviceHtmlStatusInfo( pElement->m_reg, bmdf ? &mdf : NULL ); m_htmlWnd->SetPage(pElement->m_html); // Mark as loaded pElement->m_bLoaded = true; } else { wxMessageBox(_("Failed to read registers!")); } } else if (INTERFACE_VSCP == m_interfaceType) { cguid destguid; destguid = m_ifguid; destguid.setNicknameID( pElement->m_nodeid ); if ( CANAL_ERROR_SUCCESS == m_csw.getTcpIpInterface()->readLevel2Registers( 0x80, // reg 0, // Page 128, // count pElement->m_reg + 0x80, m_ifguid, &destguid, false ) ) { uint8_t preg_url[33]; memset( preg_url, 0, sizeof(preg_url)); memcpy( preg_url, pElement->m_reg + 0xe0, 32 ); bool bmdf = m_csw.loadMDF( this, preg_url, url, &mdf ); pElement->m_html = vscp_getDeviceHtmlStatusInfo( pElement->m_reg, bmdf ? &mdf : NULL ); m_htmlWnd->SetPage(pElement->m_html); // Mark as loaded pElement->m_bLoaded = true; } else { wxMessageBox(_("Failed to read registers!")); } } } event.Skip(false); }
void frmScanforDevices::getNodeInfo(wxCommandEvent& event) { CMDF mdf; wxString url; scanElement *pElement = (scanElement *) m_DeviceTree->GetItemData(m_DeviceTree->GetSelection()); if (NULL != pElement) { wxProgressDialog progressDlg(_("Getting node info."), _("Reading Registers"), 256, this, wxPD_ELAPSED_TIME | wxPD_AUTO_HIDE | wxPD_CAN_ABORT); if (INTERFACE_CANAL == m_interfaceType) { bool bregs = m_csw.readLevel1Registers( this, pElement->m_reg, pElement->m_nodeid, 0, 256, &progressDlg ); uint8_t preg_url[33]; memset( preg_url, 0, sizeof(preg_url)); memcpy( preg_url, pElement->m_reg + 0xe0, 32 ); bool bmdf = m_csw.loadMDF( this, preg_url, url, &mdf ); pElement->m_html = vscp_getDeviceHtmlStatusInfo( pElement->m_reg, bmdf ? &mdf : NULL ); m_htmlWnd->SetPage(pElement->m_html); // Mark as loaded if ( bregs ) pElement->m_bLoaded = true; } else if (INTERFACE_VSCP == m_interfaceType) { cguid destguid; destguid.setLSB( pElement->m_nodeid ); bool bregs = m_csw.readLevel2Registers( this, pElement->m_reg, m_ifguid, 0, 256, &destguid, &progressDlg, false ); // If read fails abort if (!bregs) return; uint8_t preg_url[33]; memset( preg_url, 0, sizeof(preg_url)); memcpy( preg_url, pElement->m_reg + 0xe0, 32 ); bool bmdf = m_csw.loadMDF( this, preg_url, url, &mdf ); pElement->m_html = vscp_getDeviceHtmlStatusInfo( pElement->m_reg, bmdf ? &mdf : NULL ); m_htmlWnd->SetPage(pElement->m_html); // Mark as loaded if ( bregs ) pElement->m_bLoaded = true; } } event.Skip(false); }