00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 00003 // -- BEGIN LICENSE BLOCK ---------------------------------------------- 00004 00024 // -- END LICENSE BLOCK ------------------------------------------------ 00025 00026 //---------------------------------------------------------------------- 00033 //---------------------------------------------------------------------- 00034 00035 #include <sick_safetyscanners/datastructure/CommSettings.h> 00036 00037 namespace sick { 00038 namespace datastructure { 00039 00040 CommSettings::CommSettings() {} 00041 00042 boost::asio::ip::address_v4 CommSettings::getHostIp() const 00043 { 00044 return m_host_ip; 00045 } 00046 00047 void CommSettings::setHostIp(const boost::asio::ip::address_v4& host_ip) 00048 { 00049 m_host_ip = host_ip; 00050 } 00051 00052 void CommSettings::setHostIp(const std::string& host_ip) 00053 { 00054 m_host_ip = boost::asio::ip::address_v4::from_string(host_ip); 00055 } 00056 00057 uint16_t CommSettings::getHostUdpPort() const 00058 { 00059 return m_host_udp_port; 00060 } 00061 00062 void CommSettings::setHostUdpPort(const uint16_t& host_udp_port) 00063 { 00064 m_host_udp_port = host_udp_port; 00065 } 00066 00067 uint8_t CommSettings::getChannel() const 00068 { 00069 return m_channel; 00070 } 00071 00072 void CommSettings::setChannel(const uint8_t& channel) 00073 { 00074 m_channel = channel; 00075 } 00076 00077 bool CommSettings::getEnabled() const 00078 { 00079 return m_enabled; 00080 } 00081 00082 void CommSettings::setEnabled(bool enabled) 00083 { 00084 m_enabled = enabled; 00085 } 00086 00087 uint8_t CommSettings::getEInterfaceType() const 00088 { 00089 return m_e_interface_type; 00090 } 00091 00092 void CommSettings::setEInterfaceType(const uint8_t& e_interface_type) 00093 { 00094 m_e_interface_type = e_interface_type; 00095 } 00096 00097 uint16_t CommSettings::getPublishingFrequency() const 00098 { 00099 return m_publishing_frequency; 00100 } 00101 00102 void CommSettings::setPublishingFrequency(const uint16_t& publishing_frequency) 00103 { 00104 m_publishing_frequency = publishing_frequency; 00105 } 00106 00107 uint32_t CommSettings::getStartAngle() const 00108 { 00109 return m_start_angle; 00110 } 00111 00112 void CommSettings::setStartAngle(const uint32_t& start_angle) 00113 { 00114 m_start_angle = start_angle * 4194304.0; 00115 } 00116 00117 uint32_t CommSettings::getEndAngle() const 00118 { 00119 return m_end_angle; 00120 } 00121 00122 void CommSettings::setEndAngle(const uint32_t& end_angle) 00123 { 00124 m_end_angle = end_angle * 4194304.0; 00125 } 00126 00127 uint16_t CommSettings::getFeatures() const 00128 { 00129 return m_features; 00130 } 00131 00132 void CommSettings::setFeatures(const uint16_t& features) 00133 { 00134 m_features = features; 00135 } 00136 00137 void CommSettings::setFeatures(const bool general_system_state, 00138 const bool derived_settings, 00139 const bool measurement_data, 00140 const bool intrusion_data, 00141 const bool application_data) 00142 { 00143 m_features = 0; 00144 m_features += general_system_state << 0; 00145 m_features += derived_settings << 1; 00146 m_features += measurement_data << 2; 00147 m_features += intrusion_data << 3; 00148 m_features += application_data << 4; 00149 } 00150 00151 boost::asio::ip::address_v4 CommSettings::getSensorIp() const 00152 { 00153 return m_sensor_ip; 00154 } 00155 00156 void CommSettings::setSensorIp(const boost::asio::ip::address_v4& sensor_ip) 00157 { 00158 m_sensor_ip = sensor_ip; 00159 } 00160 00161 void CommSettings::setSensorIp(const std::string& host_ip) 00162 { 00163 m_sensor_ip = boost::asio::ip::address_v4::from_string(host_ip); 00164 } 00165 00166 uint16_t CommSettings::getSensorTcpPort() const 00167 { 00168 return m_sensor_tcp_port; 00169 } 00170 00171 void CommSettings::setSensorTcpPort(const uint16_t& sensor_tcp_port) 00172 { 00173 m_sensor_tcp_port = sensor_tcp_port; 00174 } 00175 00176 00177 } // namespace datastructure 00178 } // namespace sick