Subversion Repositories HomeAutomation

Rev

Rev 1918 | Rev 1959 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1918 Rev 1919
Line 234... Line 234...
234
   
234
   
235
        std::string* payload_str;
235
        std::string* payload_str;
236
    payload_str = static_cast<std::string*>(message->GetPayload().get());
236
    payload_str = static_cast<std::string*>(message->GetPayload().get());
237
    std::string line = *payload_str;
237
    std::string line = *payload_str;
238
        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");
239
        //LOG.Info("Got "+ line + "end");
246
   
240
   
247
        data[0] = PACKET_START;
241
        data[0] = PACKET_START;
248
        std::string value = line.substr(4,2);
242
        std::string value = line.substr(4,2);
249
    //LOG.Info("<"+ value + ">");
243
    //LOG.Info("<"+ value + ">");
250
    data[1] = common::FromHex(value);
244
    data[4] = common::FromHex(value);
251
    //LOG.Info("id1: " + value + " data: ");//+ data[1]);
245
    //LOG.Info("id1: " + value + " data: ");//+ data[1]);
252
   
246
   
253
    value = line.substr(6,2);
247
    value = line.substr(6,2);
254
    //LOG.Info("<"+ value + ">");
248
    //LOG.Info("<"+ value + ">");
255
   
249
   
256
    data[2] = common::FromHex(value);
250
    data[3] = common::FromHex(value);
257
    //LOG.Info("id2: " + value + " data: ");//+ data[2]);
251
    //LOG.Info("id2: " + value + " data: ");//+ data[2]);
258
   
252
   
259
    value = line.substr(8,2);
253
    value = line.substr(8,2);
260
    data[3] = common::FromHex(value);
254
    data[2] = common::FromHex(value);
261
    //LOG.Info("id3: " + value + " data: ");//+ data[3]);
255
    //LOG.Info("id3: " + value + " data: ");//+ data[3]);
262
   
256
   
263
    value = line.substr(10,2);
257
    value = line.substr(10,2);
264
    data[4] = common::FromHex(value);
258
    data[1] = common::FromHex(value);
265
    //LOG.Info("id4: " + value + " data: ");//+ data[4]);
259
    //LOG.Info("id4: " + value + " data: ");//+ data[4]);
266
   
260
   
267
    value = line.substr(13,1);
261
    value = line.substr(13,1);
268
    data[5] = common::FromHex(value);
262
    data[5] = common::FromHex(value);
269
    //LOG.Info("1: " + value + " data: ");//+ data[5]);
263
    //LOG.Info("1: " + value + " data: ");//+ data[5]);
Line 271... Line 265...
271
    value = line.substr(15,1);
265
    value = line.substr(15,1);
272
    data[6] = common::FromHex(value);
266
    data[6] = common::FromHex(value);
273
    //LOG.Info("1: " + value + " data: ");//+ data[6]);
267
    //LOG.Info("1: " + value + " data: ");//+ data[6]);
274
 
268
 
275
        unsigned char length = 0;
269
        unsigned char length = 0;
276
        unsigned char index = 3;
270
        unsigned char index = 0;
277
        while (length < 8 && index + 16 < (unsigned char)line.length())
271
        while (length < 8 && index + 16 < (unsigned char)line.length())
278
        {
272
        {
279
            value = line.substr(index+17,2);
273
            value = line.substr(index+17,2);
280
        data[8+length] = common::FromHex(value);
274
        data[8+length] = common::FromHex(value);
281
        //LOG.Info("data: " + value + " data: ");//+ data[6]);
275
        //LOG.Info("data: " + value + " data: ");//+ data[6]);
Line 286... Line 280...
286
        data[7] = length;
280
        data[7] = length;
287
        data[16] = PACKET_END;
281
        data[16] = PACKET_END;
288
       
282
       
289
        data.SetSize(17);
283
        data.SetSize(17);
290
       
284
       
291
        //LOG.Debug("Bytes: " + data.ToDebugString());
285
        //LOG.Info("Bytes: " + data.ToDebugString());
292
        net::Manager::Instance()->SendTo(this->client_id_, data);
286
        net::Manager::Instance()->SendTo(this->client_id_, data);
293
    }
287
    }
294
}
288
}
295
 
289
 
296
void Network::SlotOnNewDataHandler(net::ClientId client_id, net::ServerId server_id, common::Byteset data)
290
void Network::SlotOnNewDataHandler(net::ClientId client_id, net::ServerId server_id, common::Byteset data)