Subversion Repositories HomeAutomation

Rev

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] = boost::lexical_cast<int>(value);
250
    data[1] = common::FromHex(value);
242
    LOG.Info("id1: " + value + " data: ");//+ data[1]);
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] = boost::lexical_cast<int>(value);
256
    data[2] = common::FromHex(value);
246
    LOG.Info("id2: " + value + " data: ");//+ data[2]);
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] = boost::lexical_cast<int>(value);
260
    data[3] = common::FromHex(value);
250
    LOG.Info("id3: " + value + " data: ");//+ data[3]);
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] = boost::lexical_cast<int>(value);
264
    data[4] = common::FromHex(value);
254
    LOG.Info("id4: " + value + " data: ");//+ data[4]);
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] = boost::lexical_cast<int>(value);
268
    data[5] = common::FromHex(value);
258
    LOG.Info("1: " + value + " data: ");//+ data[5]);
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] = boost::lexical_cast<int>(value);
272
    data[6] = common::FromHex(value);
262
    LOG.Info("1: " + value + " data: ");//+ data[6]);
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(index,2);
279
            value = line.substr(index+17,2);
269
        data[8+length] = boost::lexical_cast<int>(value);
280
        data[8+length] = common::FromHex(value);
270
        LOG.Info("data: " + value + " data: ");//+ data[6]);
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;