/* Return the MAVLink component ID of the component */
int MAVLinkComponent::getComponentID() {
	if (isValidComponent()) {
		return componentIDs[myComponentNumber];
	} else {
		return -1;
	}
}
/* Return the low 32-bits of the 64-bit XBee address */
long MAVLinkComponent::getPhysicalAddressLow() {
	if (isValidComponent()) {
		return physicalAddress[myComponentNumber][1];
	} else {
		return -1;
	}
}
Exemplo n.º 3
0
 std::vector<std::string> GetValidIPAddresses(const std::string &s) {
   std::vector<std::string> valid;
   string first, second, third, fourth;
   for (size_t i=1; i<=3 && i<s.size(); ++i) {
     if (!isValidComponent(0, first=s.substr(0, i)))
       break;
     for (size_t j=1; j<=3 && (i+j)<s.size(); ++j) {
       if (!isValidComponent(1, second=s.substr(i, j)))
         break;
       for (size_t k=1; k<=3 && (i+j+k) < s.size(); ++k) {
         if (!isValidComponent(2, third=s.substr(i+j, k)))
           break;
         if (isValidComponent(3, fourth=s.substr(i+j+k)))
           valid.emplace_back(first + "." + second + "." + third + "." + fourth);
       }
     }
   }
   return valid;
 }