int newObjectId = getNewIntfaceObjectId(newIntface);
println("if (set" + newObjectId + "Allowed.find(methodId) == set" + newObjectId + "Allowed.end()) {");
println("cerr << \"Callback object for " + intface + " is not allowed to access method: \" << methodId;");
- println("exit(-1);");
+ println("return;");
println("}");
}
}
println(" else {");
println("cerr << \"Illegal object Id: \" << to_string(objId);");
// TODO: perhaps need to change this into "throw" to make it cleaner (allow stack unfolding)
- println("exit(-1);");
+ println("return;");
println("}");
println("}");
println("}\n");
println("if (_objectId == object" + newObjectId + "Id) {");
println("if (set" + newObjectId + "Allowed.find(methodId) == set" + newObjectId + "Allowed.end()) {");
println("cerr << \"Object with object Id: \" << _objectId << \" is not allowed to access method: \" << methodId << endl;");
- println("exit(-1);");
+ println("return;");
println("}");
println("}");
println("else {");
println("cerr << \"Object Id: \" << _objectId << \" not recognized!\" << endl;");
- println("exit(-1);");
+ println("return;");
println("}");
}
}
m_addrRemote.sin_addr = *((struct in_addr *) he->h_addr);
memset(&(m_addrRemote.sin_zero), 0, 8);
- if (connect(m_iSock, (struct sockaddr *) &m_addrRemote, sizeof(struct sockaddr)) == -1) {
-
- perror("IoTSocketClient: Connect m_iSock error!");
- return;
- }
+ // Make socket client wait for socket server to be ready
+ while (connect(m_iSock, (struct sockaddr *) &m_addrRemote, sizeof(struct sockaddr)) == -1) { }
// Send out request for reversed bits or not
char temp[1];
--- /dev/null
+#include <iostream>
+#include <string>
+#include "TestClassComplete_Stub.hpp"
+#include "CallBack.hpp"
+#include "IoTRMICall.hpp"
+
+using namespace std;
+
+int main(int argc, char *argv[])
+{
+
+ int _port = 50044;
+ const char* _address = "localhost";
+ //const char* address = "128.195.136.170"; // dc-9.calit2.uci.edu
+ int _rev = 0;
+ bool bResult = false;
+
+ IoTRMICall *rmiCall = new IoTRMICall(_port, _address, _rev, &bResult);
+ cout << "Successfully connecting!" << endl << endl;
+ delete rmiCall;
+
+ return 0;
+}
cout << "Return value: " << tcStub->getDouble(12345.678) << endl;
cout << "Return value: " << tcStub->getBoolean(true) << endl;
cout << "Return value: " << tcStub->getChar('c') << endl;
-/* cout << "==== ARRAY ====" << endl;
+ cout << "==== ARRAY ====" << endl;
vector<char> in1;
in1.push_back(68);
in1.push_back(69);
cout << "Name: " << st.name << endl;
cout << "Value:" << st.value << endl;
cout << "Year" << st.year << endl;
- }*/
+ }
cout << "==== CALLBACK ====" << endl;
CallBackInterface *cbSingle = new CallBack(2354);
tcStub->registerCallback(cbSingle);
--- /dev/null
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+import iotrmi.Java.IoTRMICall;
+import iotruntime.master.CommunicationHandler;
+
+public class TestClass_Debug {
+
+ public static void main(String[] args) throws Exception {
+
+ CommunicationHandler comHan = new CommunicationHandler(true);
+ int numOfPorts = 1;
+ int[] ports = comHan.getCallbackPorts(numOfPorts);
+
+ int _port = 56205;
+ String _address = "localhost";
+ //String address = "128.195.136.170"; // dc-9.calit2.uci.edu
+ int _rev = 0;
+
+ IoTRMICall rmiCall = new IoTRMICall(_port, _address, _rev);
+ System.out.println("Creating a new connection!!!");
+ }
+}
System.out.println("Return value: " + tcstub.getBoolean(true));
System.out.println("Return value: " + tcstub.getChar('c'));
-/* System.out.println("==== ARRAY ====");
+ System.out.println("==== ARRAY ====");
byte[] in1 = { 68, 69 };
System.out.println("Return value: " + Arrays.toString(tcstub.getByteArray(in1)));
short[] in2 = { (short)1234, (short)1235 };
System.out.println("Value: " + st.value);
System.out.println("Year: " + st.year);
}
-*/
+
System.out.println("==== CALLBACKS ====");
CallBackInterface cbSingle = new CallBack(2354);
tcstub.registerCallback(cbSingle);