* limitations under the License.
*/
-#include <telephony/ril.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <termios.h>
#include <v8.h>
+#include "ril.h"
-#include "ril.pb.h"
+#include "hardware/ril/mock-ril/src/proto/ril.pb.h"
#include "ctrl_server.h"
#include "logging.h"
//#define MOCK_RIL_DEBUG
#ifdef MOCK_RIL_DEBUG
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
#else
void * Worker(void *param)
{
- LOGD("UnsolicitedThread::Worker E param=%p", param);
+ ALOGD("UnsolicitedThread::Worker E param=%p", param);
v8::Locker locker;
v8::Locker locker;
}
- LOGD("UnsolicitedThread::Worker X param=%p", param);
+ ALOGD("UnsolicitedThread::Worker X param=%p", param);
return NULL;
}
void startMockRil(v8::Handle<v8::Context> context) {
v8::HandleScope handle_scope;
+ v8::TryCatch try_catch;
// Get handle to startMockRil and call it.
v8::Handle<v8::String> name = v8::String::New("startMockRil");
v8::Handle<v8::Function> start =
v8::Handle<v8::Function>::Cast(functionValue);
- start->Call(context->Global(), 0, NULL);
+ v8::Handle<v8::Value> result = start->Call(context->Global(), 0, NULL);
+ if (try_catch.HasCaught()) {
+ LOGE("startMockRil error");
+ ReportException(&try_catch);
+ LOGE("FATAL ERROR: Unsable to startMockRil.");
+ } else {
+ v8::String::Utf8Value result_string(result);
+ LOGE("startMockRil result=%s", ToCString(result_string));
+ }
+
}
int ret;
pthread_attr_t attr;
- LOGD("RIL_Init E: ----------------");
+ ALOGD("RIL_Init E: ----------------");
// Initialize V8
v8::V8::Initialize();
s_rilenv = &testEnv;
-#if 0
- LOGD("RIL_Init run tests #####################");
- testJsSupport(context);
- testRequests(context);
- experiments(context);
- testWorker();
- testWorkerV8(context);
- testJs(context);
- LOGD("RIL_Init tests completed ###############");
-#endif
-
// load/run mock_ril.js
char *buffer;
int status = ReadFile("/sdcard/data/mock_ril.js", &buffer);
requestsInit(context, &s_requestWorkerQueue);
responsesInit(context);
+#if 0
+ ALOGD("RIL_Init run tests #####################");
+ testJsSupport(context);
+ testRequests(context);
+ experiments(context);
+ testWorker();
+ testWorkerV8(context);
+ ALOGD("RIL_Init tests completed ###############");
+#endif
+
// Register our call backs so when we startMockRil
// and it wants to send unsolicited messages the
// mock ril is registered
ut->Run(NULL);
#endif
- LOGD("RIL_Init X: ----------------");
+ ALOGD("RIL_Init X: ----------------");
return &s_callbacks;
}