Subversion Repositories HomeAutomation

Rev

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

Rev 969 Rev 976
Line 25... Line 25...
25
#include "canmessage.h"
25
#include "canmessage.h"
26
 
26
 
27
void CanMessage::setRaw(string rawHex)
27
void CanMessage::setRaw(string rawHex)
28
{
28
{
29
    CanIdTranslator &translator = CanIdTranslator::getInstance();
29
    CanIdTranslator &translator = CanIdTranslator::getInstance();
30
    SyslogStream &slog = SyslogStream::getInstance();
30
    //SyslogStream &slog = SyslogStream::getInstance();
31
 
31
 
32
    //PKT 00060102 1 0 00 00 c4
32
    //PKT 00060102 1 0 00 00 c4
33
 
33
 
34
    rawHex = trim(rawHex, '\n');
34
    rawHex = trim(rawHex, '\n');
35
    rawHex = trim(rawHex);
35
    rawHex = trim(rawHex);
36
 
36
 
37
    vector<string> parts = explode(" ", rawHex);
37
    vector<string> parts = explode(" ", rawHex);
38
 
38
 
39
    if (parts.size() < 2 || parts[0].compare("PKT") != 0)
39
    if (parts.size() < 2 || parts[0].compare("PKT") != 0)
40
    {
40
    {
41
        slog << "Malformed can message received from canDaemon: \"" << rawHex << "\"\n";
41
        //slog << "Malformed can message received from canDaemon: \"" << rawHex << "\"\n";
42
        throw new CanMessageException("Malformed can message received from canDaemon");
42
        throw new CanMessageException("Malformed can message received from canDaemon");
43
    }
43
    }
44
 
44
 
45
    myRawHeaderBin = hex2bin(parts[1]);
45
    myRawHeaderBin = hex2bin(parts[1]);
46
 
46