Rev 1600 | Rev 1607 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1600 | Rev 1605 | ||
|---|---|---|---|
| Line 235... | Line 235... | ||
| 235 | } |
235 | } |
| 236 | } |
236 | } |
| 237 | 237 | ||
| 238 | xml::Node::NodeList Protocol::GetCommandVariables(std::string command_name, std::string module_name) |
238 | xml::Node::NodeList Protocol::GetCommandVariables(std::string command_name, std::string module_name) |
| 239 | { |
239 | { |
| - | 240 | xml::Node node; |
|
| - | 241 | ||
| 240 | try |
242 | try |
| 241 | { |
243 | { |
| 242 |
|
244 | node = this->root_node_.FindChild("commands").SelectChild("name", command_name, "module", module_name); |
| - | 245 | ||
| - | 246 | try |
|
| - | 247 | { |
|
| - | 248 | return node.FindChild("variables").GetChildren(); |
|
| - | 249 | } |
|
| - | 250 | catch (std::runtime_error& e) |
|
| - | 251 | { |
|
| - | 252 | return xml::Node::NodeList(); |
|
| - | 253 | } |
|
| 243 | } |
254 | } |
| 244 | catch (std::runtime_error& e) |
255 | catch (std::runtime_error& e) |
| 245 | { |
256 | { |
| 246 | } |
257 | } |
| - | 258 | ||
| 247 | 259 | ||
| 248 | try |
260 | try |
| 249 | { |
261 | { |
| 250 |
|
262 | node = this->root_node_.FindChild("commands").SelectChild("name", command_name); |
| - | 263 | ||
| - | 264 | try |
|
| - | 265 | { |
|
| - | 266 | return node.FindChild("variables").GetChildren(); |
|
| - | 267 | } |
|
| - | 268 | catch (std::runtime_error& e) |
|
| - | 269 | { |
|
| - | 270 | return xml::Node::NodeList(); |
|
| - | 271 | } |
|
| 251 | } |
272 | } |
| 252 | catch (std::runtime_error& e) |
273 | catch (std::runtime_error& e) |
| 253 | { |
274 | { |
| 254 | LOG.Error(e.what()); |
275 | LOG.Error(e.what()); |
| 255 | throw std::runtime_error(" |
276 | throw std::runtime_error("Could not find variables for command, name = " + command_name + ", module = " + module_name); |
| 256 | } |
277 | } |
| - | 278 | ||
| - | 279 | return xml::Node::NodeList(); |
|
| 257 | } |
280 | } |
| 258 | 281 | ||
| 259 | xml::Node::NodeList Protocol::GetNMTCommandVariables(std::string command_name) |
282 | xml::Node::NodeList Protocol::GetNMTCommandVariables(std::string command_name) |
| 260 | { |
283 | { |
| - | 284 | xml::Node node; |
|
| - | 285 | ||
| - | 286 | try |
|
| - | 287 | { |
|
| - | 288 | node = this->root_node_.FindChild("nmt_messages").SelectChild("name", command_name); |
|
| - | 289 | ||
| 261 | try |
290 | try |
| 262 | { |
291 | { |
| 263 | return |
292 | return node.FindChild("variables").GetChildren(); |
| - | 293 | } |
|
| - | 294 | catch (std::runtime_error& e) |
|
| - | 295 | { |
|
| - | 296 | return xml::Node::NodeList(); |
|
| - | 297 | } |
|
| 264 | } |
298 | } |
| 265 | catch (std::runtime_error& e) |
299 | catch (std::runtime_error& e) |
| 266 | { |
300 | { |
| 267 | LOG.Error(e.what()); |
301 | LOG.Error(e.what()); |
| 268 | throw std::runtime_error(" |
302 | throw std::runtime_error("Could not find variables for nmt command, name = " + command_name); |
| 269 | } |
303 | } |
| - | 304 | ||
| - | 305 | return xml::Node::NodeList(); |
|
| 270 | } |
306 | } |
| 271 | 307 | ||
| 272 | std::string Protocol::DecodeInt(type::Bitset& bitset, unsigned int start_bit, unsigned int bit_length) |
308 | std::string Protocol::DecodeInt(type::Bitset& bitset, unsigned int start_bit, unsigned int bit_length) |
| 273 | { |
309 | { |
| 274 | unsigned long raw_bit_value = bitset.Read(start_bit, bit_length); |
310 | unsigned long raw_bit_value = bitset.Read(start_bit, bit_length); |