Rev 1917 | Rev 1919 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1917 | Rev 1918 | ||
|---|---|---|---|
| Line 229... | Line 229... | ||
| 229 | 229 | ||
| 230 | //LOG.Debug("Bytes: " + data.ToDebugString()); |
230 | //LOG.Debug("Bytes: " + data.ToDebugString()); |
| 231 | net::Manager::Instance()->SendTo(this->client_id_, data); |
231 | net::Manager::Instance()->SendTo(this->client_id_, data); |
| 232 | } else if (message->GetType() == broker::Message::CAN_RAW_MESSAGE) |
232 | } else if (message->GetType() == broker::Message::CAN_RAW_MESSAGE) |
| 233 | { |
233 | { |
| - | 234 | ||
| 234 | std::string* payload_str; |
235 | std::string* payload_str; |
| 235 | payload_str = static_cast<std::string*>(message->GetPayload().get()); |
236 | payload_str = static_cast<std::string*>(message->GetPayload().get()); |
| 236 | std::string line = *payload_str; |
237 | std::string line = *payload_str; |
| 237 | common::Byteset data(17); |
238 | common::Byteset data(17); |
| - | 239 | //replace(line.begin(), line.end(), 'a', 'A'); |
|
| - | 240 | //replace(line.begin(), line.end(), 'b', 'B'); |
|
| - | 241 | //replace(line.begin(), line.end(), 'c', 'C'); |
|
| - | 242 | //replace(line.begin(), line.end(), 'd', 'D'); |
|
| - | 243 | //replace(line.begin(), line.end(), 'e', 'E'); |
|
| - | 244 | //replace(line.begin(), line.end(), 'f', 'F'); |
|
| - | 245 | //LOG.Info("Got "+ line + "end"); |
|
| 238 | 246 | ||
| 239 | data[0] = PACKET_START; |
247 | data[0] = PACKET_START; |
| 240 | std::string value = line.substr(4,2); |
248 | std::string value = line.substr(4,2); |
| - | 249 | //LOG.Info("<"+ value + ">"); |
|
| 241 | data[1] = |
250 | data[1] = common::FromHex(value); |
| 242 | LOG. |
251 | //LOG.Info("id1: " + value + " data: ");//+ data[1]); |
| 243 | 252 | ||
| 244 | value = line.substr(6,2); |
253 | value = line.substr(6,2); |
| - | 254 | //LOG.Info("<"+ value + ">"); |
|
| - | 255 | ||
| 245 | data[2] = |
256 | data[2] = common::FromHex(value); |
| 246 | LOG. |
257 | //LOG.Info("id2: " + value + " data: ");//+ data[2]); |
| 247 | 258 | ||
| 248 | value = line.substr(8,2); |
259 | value = line.substr(8,2); |
| 249 | data[3] = |
260 | data[3] = common::FromHex(value); |
| 250 | LOG. |
261 | //LOG.Info("id3: " + value + " data: ");//+ data[3]); |
| 251 | 262 | ||
| 252 | value = line.substr(10,2); |
263 | value = line.substr(10,2); |
| 253 | data[4] = |
264 | data[4] = common::FromHex(value); |
| 254 | LOG. |
265 | //LOG.Info("id4: " + value + " data: ");//+ data[4]); |
| 255 | 266 | ||
| 256 | value = line.substr(13,1); |
267 | value = line.substr(13,1); |
| 257 | data[5] = |
268 | data[5] = common::FromHex(value); |
| 258 | LOG. |
269 | //LOG.Info("1: " + value + " data: ");//+ data[5]); |
| 259 | 270 | ||
| 260 | value = line.substr(15,1); |
271 | value = line.substr(15,1); |
| 261 | data[6] = |
272 | data[6] = common::FromHex(value); |
| 262 | LOG. |
273 | //LOG.Info("1: " + value + " data: ");//+ data[6]); |
| 263 | 274 | ||
| 264 | unsigned char length = 0; |
275 | unsigned char length = 0; |
| 265 | unsigned char index = 3; |
276 | unsigned char index = 3; |
| 266 | while (length < 8 && index + 16 < (unsigned char)line.length()) |
277 | while (length < 8 && index + 16 < (unsigned char)line.length()) |
| 267 | { |
278 | { |
| 268 | value = line.substr( |
279 | value = line.substr(index+17,2); |
| 269 | data[8+length] = |
280 | data[8+length] = common::FromHex(value); |
| 270 | LOG. |
281 | //LOG.Info("data: " + value + " data: ");//+ data[6]); |
| 271 | index += 3; |
282 | index += 3; |
| 272 | length++; |
283 | length++; |
| 273 | } |
284 | } |
| 274 | 285 | ||
| 275 | data[7] = length; |
286 | data[7] = length; |