Rev 2066 | Rev 2087 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 2066 | Rev 2081 | ||
|---|---|---|---|
| Line 228... | Line 228... | ||
| 228 | 228 | ||
| 229 | data[16] = PACKET_END; |
229 | data[16] = PACKET_END; |
| 230 | 230 | ||
| 231 | //LOG.Debug("Bytes: " + data.ToDebugString()); |
231 | //LOG.Debug("Bytes: " + data.ToDebugString()); |
| 232 | net::Manager::Instance()->SendTo(this->client_id_, data); |
232 | net::Manager::Instance()->SendTo(this->client_id_, data); |
| - | 233 | } |
|
| 233 |
|
234 | else if (message->GetType() == broker::Message::CAN_RAW_MESSAGE) |
| 234 | { |
235 | { |
| 235 | - | ||
| 236 | std::string* payload_str; |
236 | std::string* payload_str; |
| 237 | payload_str = static_cast<std::string*>(message->GetPayload().get()); |
237 | payload_str = static_cast<std::string*>(message->GetPayload().get()); |
| 238 | std::string line = *payload_str; |
238 | std::string line = *payload_str; |
| - | 239 | ||
| - | 240 | if (line.length() < 17) |
|
| - | 241 | { |
|
| - | 242 | log::Error(log_module_, "Packet was to short: \"%s\".", line.data()); |
|
| - | 243 | return; |
|
| - | 244 | } |
|
| - | 245 | ||
| - | 246 | ||
| 239 | common::Byteset data(17); |
247 | common::Byteset data(17); |
| 240 | //LOG.Info("Got "+ line + "end"); |
248 | //LOG.Info("Got "+ line + "end"); |
| 241 | 249 | ||
| 242 | data[0] = PACKET_START; |
250 | data[0] = PACKET_START; |
| 243 | std::string value = line.substr(4,2); |
251 | std::string value = line.substr(4,2); |
| Line 300... | Line 308... | ||
| 300 | { |
308 | { |
| 301 | log::Extreme(log_module_, "data[%u] = %u, have_start = %s, this->buffer_.size() = %u", n, (unsigned int)data[n], have_start ? "true" : "false", this->buffer_.size()); |
309 | log::Extreme(log_module_, "data[%u] = %u, have_start = %s, this->buffer_.size() = %u", n, (unsigned int)data[n], have_start ? "true" : "false", this->buffer_.size()); |
| 302 | 310 | ||
| 303 | if (have_start) |
311 | if (have_start) |
| 304 | { |
312 | { |
| 305 | if (data[n] == PACKET_END) |
313 | if (data[n] == PACKET_END && this->buffer_.size() >= 15) |
| 306 | { |
314 | { |
| 307 | log::Extreme(log_module_, "PACKET_END"); |
315 | log::Extreme(log_module_, "PACKET_END"); |
| 308 | 316 | ||
| 309 | while (this->buffer_.size() < 15) |
317 | while (this->buffer_.size() < 15) |
| 310 | { |
318 | { |