Simple RPC vector return

I'm struggling with the simple RPC library. I have managed to get it to work for functions, class functions and to get it to return simple data types such as float or boolean. However I am struggling when I am calling a class function that returns a vector.

Here is a very simple example:

#include <simpleRPC.h>
#include <vector>
class ExampleClass{
public:
  ExampleClass(){}
     std::vector<int> ExampleMethod(int exampleParameter1, int exampleParameter2){
      std::vector<int> exampleVector;
      exampleVector.push_back(exampleParameter1);
      exampleVector.push_back(exampleParameter2);
return exampleVector;
     }
};
ExampleClass ExampleInstance();
void setup(){
  Serial.begin(9600);
}
void loop(){
    interface(
    Serial,
    pack(&ExampleInstance, &ExampleClass::ExampleMethod),
"exampleFunction: This function returns a vector");
}

And I get the following error:
error: no matching function for call to 'rpcTypeOf(Stream&, std::vector&)'

Any advice?

std::vector is not supported in this release of the library, there is a surrogate named Vector included instead.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.