AutoShuntCalResult WirelessNode_Impl::autoShuntCal(const ChannelMask& mask, const ShuntCalCmdInfo& commandInfo) { //verify the node supports this operation if(!features().supportsAutoShuntCal()) { throw Error_NotSupported("AutoShuntCal is not supported by this Node."); } //verify the channel mask supports this operation if(!features().supportsChannelSetting(WirelessTypes::chSetting_autoShuntCal, mask)) { throw Error_NotSupported("AutoShuntCal is not supported by the provided channel(s)."); } uint8 channel = mask.lastChEnabled(); WirelessTypes::ChannelType chType = features().channelType(channel); AutoShuntCalResult result; bool success = m_baseStation.node_autoShuntCal(m_address, commandInfo, channel, model(), chType, result); if(!success) { throw Error_NodeCommunication(m_address, "AutoShuntCal has failed."); } return result; }
AutoCalResult_shmLink WirelessNode_Impl::autoCal_shmLink() { WirelessModels::NodeModel nodeModel = features().m_nodeInfo.model(); //verify the node supports autocal if(!features().supportsAutoCal()) { throw Error_NotSupported("AutoCal is not supported by this Node."); } //verify the node is the correct model if(nodeModel != WirelessModels::node_shmLink2 && nodeModel != WirelessModels::node_shmLink2_cust1) { throw Error_NotSupported("autoCal_shmLink is not supported by this Node's model."); } //perform the autocal command by the base station AutoCalResult_shmLink result; bool success = m_baseStation.node_autocal_shm(m_address, result); if(!success) { throw Error_NodeCommunication(m_address, "AutoCal has failed."); } return result; }
std::unique_ptr<BaseStationFeatures> BaseStationFeatures::create(BaseStationInfo& info) { switch(info.model()) { case WirelessModels::base_wsdaBase_104_usb: return std::unique_ptr<BaseStationFeatures>(new BaseStationFeatures_usb(info)); case WirelessModels::base_wsdaBase_101_analog: return std::unique_ptr<BaseStationFeatures>(new BaseStationFeatures_analog(info)); case WirelessModels::base_wsdaBase_102_rs232: return std::unique_ptr<BaseStationFeatures>(new BaseStationFeatures_rs232(info)); case WirelessModels::base_wsdaBase_oem: return std::unique_ptr<BaseStationFeatures>(new BaseStationFeatures_oem(info)); case WirelessModels::base_wsda_1000: case WirelessModels::base_wsda_1500: case WirelessModels::base_wsda_2000: return std::unique_ptr<BaseStationFeatures>(new BaseStationFeatures_wsda(info)); default: //we don't know anything about this node, throw an exception throw Error_NotSupported("The BaseStation model (" + Utils::toStr(info.model()) + ") is not supported by MSCL."); } }
const WirelessTypes::WirelessSampleRates NodeFeatures_vlink200::sampleRates(WirelessTypes::SamplingMode samplingMode, WirelessTypes::DataCollectionMethod dataCollectionMethod) const { //the list of sample rates varies for each sampling mode switch(samplingMode) { case WirelessTypes::samplingMode_nonSync: if(dataCollectionMethod == WirelessTypes::collectionMethod_logOnly) { return AvailableSampleRates::continuous_log_gen2; } else { return AvailableSampleRates::continuous_nonSync_gen2; } case WirelessTypes::samplingMode_sync: if(dataCollectionMethod == WirelessTypes::collectionMethod_logOnly) { return AvailableSampleRates::continuous_log_gen2; } else { return AvailableSampleRates::continuous_sync_gen2; } case WirelessTypes::samplingMode_syncBurst: case WirelessTypes::samplingMode_syncEvent: return AvailableSampleRates::burst_gen2; default: throw Error_NotSupported("The sampling mode is not supported by this Node"); } }
void BaseStationEepromHelper::checkAnalogPairingSupported() const { //check analog pairing is supported if(!m_baseStation->features().supportsAnalogPairing()) { throw Error_NotSupported("Analog Pairing is not supported by this BaseStation."); } }
uint16 WirelessNode_Impl::getDiagnosticInterval() const { if(!features().supportsDiagnosticInfo()) { throw Error_NotSupported("Diagnostic Info is not supported by this Node."); } return m_eepromHelper->read_diagnosticInterval(); }
uint32 WirelessNode_Impl::getSensorDelay() const { if(!features().supportsSensorDelayConfig()) { throw Error_NotSupported("Sensor Delay is not supported by this Node."); } return m_eepromHelper->read_sensorDelay(); }
uint32 WirelessNode_Impl::getNumSweeps() const { //if the node doesn't support limited number of sweeps if(!features().supportsLimitedDuration()) { throw Error_NotSupported("The Number of Sweeps is not supported by this Ndoe."); } return m_eepromHelper->read_numSweeps(); }
uint16 WirelessNode_Impl::getLostBeaconTimeout() const { //if the node doesn't support lost beacon timeout if(!features().supportsLostBeaconTimeout()) { throw Error_NotSupported("Lost Beacon Timeout is not supported by this Node."); } return m_eepromHelper->read_lostBeaconTimeout(); }
TimeSpan WirelessNode_Impl::getTimeBetweenBursts() const { //if the node doesn't support burst mode if(!features().supportsSamplingMode(WirelessTypes::samplingMode_syncBurst)) { throw Error_NotSupported("Burst Sampling is not supported by this Node."); } return m_eepromHelper->read_timeBetweenBursts(); }
const EepromLocation& ChannelGroup::getSettingEeprom(WirelessTypes::ChannelGroupSetting setting) const { try { return m_settingsMap.at(setting); } catch(std::out_of_range&) { throw Error_NotSupported("The requested setting is not supported for this ChannelGroup."); } }
const WirelessTypes::WirelessSampleRates NodeFeatures_cfBearing::sampleRates(WirelessTypes::SamplingMode samplingMode, WirelessTypes::DataCollectionMethod dataCollectionMethod) const { //the list of sample rates varies for each sampling mode switch(samplingMode) { case WirelessTypes::samplingMode_nonSync: return AvailableSampleRates::continuous_cfBearing; default: throw Error_NotSupported("The sampling mode is not supported by this Node"); } }
EventTriggerOptions WirelessNode_Impl::getEventTriggerOptions() const { //if the node doesn't support event trigger options if(!features().supportsEventTrigger()) { throw Error_NotSupported("Event Trigger is not supported by this Node."); } EventTriggerOptions result; m_eepromHelper->read_eventTriggerOptions(result); return result; }
ActivitySense WirelessNode_Impl::getActivitySense() const { //if the node doesn't support activity sense options if(!features().supportsActivitySense()) { throw Error_NotSupported("ActivitySense configuration is not supported by this Node."); } ActivitySense result; m_eepromHelper->read_activitySense(result); return result; }
HistogramOptions WirelessNode_Impl::getHistogramOptions() const { //if the node doesn't support histogram options if(!features().supportsHistogramConfig()) { throw Error_NotSupported("HistogramOptions configuration is not supported by this Node."); } HistogramOptions result; m_eepromHelper->read_histogramOptions(result); return result; }
FatigueOptions WirelessNode_Impl::getFatigueOptions() const { //if the node doesn't support fatigue options if(!features().supportsFatigueConfig()) { throw Error_NotSupported("FatigueOptions configuration is not supported by this Node."); } FatigueOptions result; m_eepromHelper->read_fatigueOptions(result); return result; }
const WirelessTypes::WirelessSampleRates NodeFeatures_iepeLink::sampleRates(WirelessTypes::SamplingMode samplingMode, WirelessTypes::DataCollectionMethod dataCollectionMethod) const { //the list of sample rates varies for each sampling mode switch(samplingMode) { case WirelessTypes::samplingMode_syncBurst: return AvailableSampleRates::burst_iepeLink; default: throw Error_NotSupported("The sampling mode is not supported by this Node"); } }
void WirelessNode_Impl::clearHistogram() { //if the node doesn't support histogram options if(!features().supportsHistogramConfig()) { throw Error_NotSupported("Histogram configuration is not supported by this Node."); } m_eepromHelper->clearHistogram(); //must cycle power for the clearing to take affect cyclePower(); }
uint16 InputRange::inputRangeToEepromVal(WirelessTypes::InputRange range, WirelessModels::NodeModel nodeType, WirelessTypes::ChannelType channelType) { const InputRangeMap& ranges = getRangeMap(nodeType, channelType); for(auto& r : ranges) { if(r.second == range) { return r.first; } } throw Error_NotSupported("Invalid Input Range Value"); }
BaseStationButton BaseStationEepromHelper::read_button(uint8 buttonNumber, BaseStationButton::UserAction action) const { //check buttons are supported if(!m_baseStation->features().supportsButtons()) { throw Error_NotSupported("Button Configuration is not supported by this BaseStation."); } //find the eeprom locations to read from EepromLocation funcEeprom = BaseStationEepromMap::buttonFuncEeprom(buttonNumber, action); EepromLocation nodeEeprom = BaseStationEepromMap::buttonNodeEeprom(buttonNumber, action); //read the function and node and build a button return BaseStationButton(static_cast<BaseStationButton::Command>(read(funcEeprom).as_uint16()), read(nodeEeprom).as_uint16()); }
void WirelessNode_Impl::getDiagnosticInfo(ChannelData& result) { //verify the node supports this operation if(!features().supportsGetDiagnosticInfo()) { throw Error_NotSupported("The Get Diagnostic Info command is not supported by this Node."); } bool success = m_baseStation.node_getDiagnosticInfo(m_address, result); if(!success) { throw Error_NodeCommunication(m_address, "Get Diagnostic Info has failed."); } }
WirelessTypes::StorageLimitMode WirelessNode_Impl::getStorageLimitMode() const { if(!features().supportsLoggedData()) { throw Error_NotSupported("Datalogging is not supported by this Node."); } if(!features().supportsStorageLimitModeConfig()) { //legacy nodes don't support this eeprom, but are //hard coded to stop when the storage limit is reached. return WirelessTypes::storageLimit_stop; } return m_eepromHelper->read_storageLimitMode(); }
void BaseStationEepromHelper::write_button(uint8 buttonNumber, BaseStationButton::UserAction action, const BaseStationButton& btn) { //check buttons are supported if(!m_baseStation->features().supportsButtons()) { throw Error_NotSupported("Button Configuration is not supported by this BaseStation."); } //find the eeprom locations to write to EepromLocation funcEeprom = BaseStationEepromMap::buttonFuncEeprom(buttonNumber, action); EepromLocation nodeEeprom = BaseStationEepromMap::buttonNodeEeprom(buttonNumber, action); //write the button's function/command write(funcEeprom, Value::UINT16(static_cast<uint16>(btn.command()))); //write the button's node address write(nodeEeprom, Value::UINT16(btn.nodeAddress())); }
const WirelessTypes::WirelessSampleRates NodeFeatures_vlink_legacy::sampleRates(WirelessTypes::SamplingMode samplingMode, WirelessTypes::DataCollectionMethod dataCollectionMethod) const { //the list of sample rates varies for each sampling mode switch(samplingMode) { case WirelessTypes::samplingMode_nonSync: case WirelessTypes::samplingMode_sync: return AvailableSampleRates::continuous; case WirelessTypes::samplingMode_syncBurst: return AvailableSampleRates::burst; case WirelessTypes::samplingMode_armedDatalog: return AvailableSampleRates::armedDatalog; default: throw Error_NotSupported("The sampling mode is not supported by this Node"); } }
DatalogDownloader::DatalogDownloader(const WirelessNode& node): m_node(node), m_foundFirstTrigger(false), m_outOfMemory(false), m_sweepCount(0) { //verify the node supports logged data if(!node.features().supportsLoggedData()) { throw Error_NotSupported("Logging is not supported by this Node."); } m_datalogDownloadVersion = m_node.features().datalogDownloadVersion(); if(m_datalogDownloadVersion == 1) { //get the datalogging information from the Node uint16 logPage = m_node.eepromHelper().read_logPage(); uint16 pageOffset = m_node.eepromHelper().read_logPageOffset(); //create the NodeMemory object (v1) m_nodeMemory.reset(new NodeMemory_v1(m_node, logPage, pageOffset)); } else { //get the datalogging session info DatalogSessionInfoResult dlInfo; if(!m_node.getBaseStation().node_getDatalogSessionInfo(node.protocol(), node.nodeAddress(), dlInfo)) { throw Error_NodeCommunication(m_node.nodeAddress(), "Failed to get the Datalog Session Info"); } //get the FlashInfo FlashInfo flashInfo = m_node.eepromHelper().read_flashInfo(); //create the Node Memory object (v2) m_nodeMemory.reset(new NodeMemory_v2(m_node, flashInfo, dlInfo.startAddress, dlInfo.maxLoggedBytes)); } }
const InputRange::InputRangeMap& InputRange::getRangeMap(WirelessModels::NodeModel nodeType, WirelessTypes::ChannelType channelType) { switch(nodeType) { case WirelessModels::node_sgLink: return RANGES_SGLINK; case WirelessModels::node_sgLink_oem: case WirelessModels::node_sgLink_oem_S: case WirelessModels::node_sgLink_micro: case WirelessModels::node_torqueLink: return RANGES_SGLINK_OEM; case WirelessModels::node_sgLink_herm: case WirelessModels::node_sgLink_herm_2600: case WirelessModels::node_sgLink_herm_2700: case WirelessModels::node_sgLink_herm_2800: return RANGES_SGLINK_HERMETIC; case WirelessModels::node_sgLink_rgd: return RANGES_SGLINK_RGD; case WirelessModels::node_shmLink: return RANGES_SHMLINK; case WirelessModels::node_vLink: case WirelessModels::node_vLink_legacy: return RANGES_VLINK; case WirelessModels::node_vLink200: case WirelessModels::node_vLink200_qbridge_1K: case WirelessModels::node_vLink200_qbridge_120: case WirelessModels::node_vLink200_qbridge_350: case WirelessModels::node_vLink200_hbridge_1K: case WirelessModels::node_vLink200_hbridge_120: case WirelessModels::node_vLink200_hbridge_350: if(channelType == WirelessTypes::chType_fullDifferential) { return RANGES_VLINK200_FULLDIFF_CHS; } else if(channelType == WirelessTypes::chType_singleEnded) { return RANGES_VLINK200_SINGLEENDED_CHS; } case WirelessModels::node_tcLink_1ch: case WirelessModels::node_tcLink_3ch: case WirelessModels::node_tcLink_6ch: case WirelessModels::node_tcLink_6ch_ip67: case WirelessModels::node_tcLink_6ch_ip67_rht: case WirelessModels::node_envLink_mini: case WirelessModels::node_rtdLink: return RANGES_TCLINK; case WirelessModels::node_envLink_pro: if(channelType == WirelessTypes::chType_diffTemperature) { return RANGES_ENVLINK_PRO_TEMPERATURE_CHS; } else if(channelType == WirelessTypes::chType_voltage) { return RANGES_ENVLINK_PRO_VOLTAGE_CHS; } case WirelessModels::node_mvPerVLink: return RANGES_MVPVLINK; } throw Error_NotSupported("Invalid Node Type"); }