2 #include "../IoTRMIObject.hpp"
3 #include "CallBack.hpp"
7 class CallBack_Skeleton : public CallBackInterface {
9 CallBack_Skeleton(CallBackInterface* _cb, int _port);
12 void waitRequestInvokeMethod();
16 const static int size = 2;
17 const static string methodSignatures[size];
20 CallBackInterface *cb;
25 const string CallBack_Skeleton::methodSignatures[CallBack_Skeleton::size] = {
33 CallBack_Skeleton::CallBack_Skeleton(CallBackInterface* _cb, int _port) {
35 bool _bResult = false;
37 rmiObj = new IoTRMIObject(_port, &_bResult, methodSignatures, size);
38 waitRequestInvokeMethod();
42 CallBack_Skeleton::~CallBack_Skeleton() {
51 void CallBack_Skeleton::waitRequestInvokeMethod() {
53 // Loop continuously waiting for incoming bytes
56 rmiObj->getMethodBytes();
57 string methodSign = rmiObj->getSignature();
58 cout << "Method sign: " << methodSign << endl;
60 if (methodSign.compare("intprintInt()") == 0) {
61 string paramCls[] = { };
63 void* paramObj[] = { };
64 rmiObj->getMethodParams(paramCls, numParam, paramObj);
65 int retVal = printInt();
66 void* retObj = &retVal;
67 rmiObj->sendReturnObj(retObj, "int");
68 } else if (methodSign.compare("voidsetInt(int)") == 0) {
69 string paramCls[] = { "int" };
72 void* paramObj[] = { ¶m1 };
73 rmiObj->getMethodParams(paramCls, numParam, paramObj);
76 string error = "Signature not recognized: " + string(methodSign);
83 int CallBack_Skeleton::printInt() {
85 return cb->printInt();
89 void CallBack_Skeleton::setInt(int _i) {