9 years, 10 months ago.

where to import a working rpc.h and related files from???

hi, i am trying to implement the RPC_Serial.cpp program given above for LPC11U24 platform for a simple python interface over serial. after compiling i get the following Error: Cannot open source input file "rpc.h": No such file or directory in "main.cpp", Line: 2, Col: 17 i tried fixing it by importing mbed-rpc library but run into whole new set of errors... help me out,

Question relating to:

what are the errors? Perhaps the application uses old API from RPC? can you share more, your repository ?

posted by Martin Kojtal 19 Jun 2014

hi Martin, the link to the repository is: http://mbed.org/users/bhavik/code/RPC_Serial/ . i have used the example RPC_Serial code given in the tutorial as it is. still cant get it to work. thsnks.

posted by bhavik gala 19 Jun 2014

hi Martin, the error was that i was using old examples for the mbed-rpc library. now i have changed my code according to the new library following this codes: 1) http://mbed.org/questions/536/Any-working-examples-for-he-new-mbed-rpc/ 2) http://mbed.org/questions/641/add_rpc_class-member-function-not-found/ .however i am getting this new Error: Identifier "RpcAnalogOut" is undefined in "main.cpp", Line: 9, Col: 24 . i checked the RpcClasses.h file it contains the following code:

code snippet from RpcClasses.h

#if DEVICE_ANALOGOUT
class RpcAnalogOut : public RPC {
public:
    RpcAnalogOut(PinName a0, const char *name=NULL) : RPC(name), o(a0) {}

    float read(void) {return o.read();}
    void write(float a0) {o.write(a0);}
    void write_u16(unsigned short a0) {o.write_u16(a0);}

    virtual const struct rpc_method *get_rpc_methods() {
        static const rpc_method rpc_methods[] = {
            {"read", rpc_method_caller<float, RpcAnalogOut, &RpcAnalogOut::read>},
            {"write", rpc_method_caller<RpcAnalogOut, float, &RpcAnalogOut::write>},
            {"write_u16", rpc_method_caller<RpcAnalogOut, unsigned short, &RpcAnalogOut::write_u16>},
            RPC_METHOD_SUPER(RPC)
        };
        return rpc_methods;
    }
    static struct rpc_class *get_rpc_class() {
        static const rpc_function funcs[] = {
            {"new", rpc_function_caller<const char*, PinName, const char*, &RPC::construct<RpcAnalogOut, PinName, const char*> >},
            RPC_METHOD_END
        };
        static rpc_class c = {"AnalogOut", funcs, NULL};
        return &c;
    }
private:
    AnalogOut o;
};
#endif

is it right??? how to remove the error??? this is my code repo: http://mbed.org/users/bhavik/code/RPC_Serial_new/

posted by bhavik gala 20 Jun 2014
Be the first to answer this question.