Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/quasar-team/CanModule
Browse files Browse the repository at this point in the history
  • Loading branch information
meeludwig committed Jun 5, 2019
2 parents 009a0ac + f197a0c commit f619ae0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion CanInterface/include/CCanAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,26 @@ class CCanAccess
inline vector<string> parseNameAndParameters(string name, string parameters){
LOG(Log::TRC, _lh) << __FUNCTION__ << " name= " << name << " parameters= " << parameters;

bool isSocketCanLinux = false;
std::size_t s = name.find("sock");
if ( s != std::string::npos ){
isSocketCanLinux = true;
}

// strip off any leading chars from port number: ":canwhatever7:" becomes just ":7:"
std::size_t found0 = name.find_first_of (":", 0);
std::size_t found1 = name.find_first_of ( "0123456789", found0 );
if ( found1 != std::string::npos ) name.erase( found0 + 1, found1 - found0 - 1 );

m_sBusName = name;
// for socketcan, have to prefix "can" to port number
if ( isSocketCanLinux ){
found0 = name.find_first_of (":", 0);
m_sBusName = name.insert( found0 + 1, "can");
} else {
m_sBusName = name;
}

LOG(Log::TRC, _lh) << __FUNCTION__ << " m_sBusName= " << m_sBusName;
vector<string> stringVector;
istringstream nameSS(name);
string temporalString;
Expand Down

0 comments on commit f619ae0

Please sign in to comment.