Changeset 14540
- Timestamp:
- 10/30/12 12:52:15 (12 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/InterpreterV8.cc
r14500 r14540 222 222 const String::Utf8Value str(args[0]); 223 223 224 const pair<int32_t, string> rc = JsState(*str); 224 const State rc = JsState(*str); 225 226 //if (rc.first<=-256) 227 // return Undefined(); 225 228 226 229 Handle<ObjectTemplate> obj = ObjectTemplate::New(); 227 230 228 obj->Set(String::New("index"), rc.first<=-256?Undefined():Integer::New(rc.first), ReadOnly); 229 obj->Set(String::New("name"), rc.first<=-256?Undefined():String::New(rc.second.c_str()), ReadOnly); 230 //obj->Set(String::New("toString"), String::New(("[Object state "+string(*str)+"]").c_str()), ReadOnly); 231 obj->Set(String::New("index"), rc.index<=-256?Undefined():Integer::New(rc.index), ReadOnly); 232 obj->Set(String::New("name"), rc.index<=-256?Undefined():String::New(rc.name.c_str()), ReadOnly); 233 obj->Set(String::New("time"), Date::New(rc.time.JavaDate()), ReadOnly); 234 //obj->Set(String::New("toString"), String::New(("[Object state "+string(*str)+":"+to_string(rc.index)+"]").c_str())); 231 235 232 236 return handle_scope.Close(obj->NewInstance()); … … 588 592 ret->Set(String::New("counter"), Integer::New(p.first), ReadOnly); 589 593 ret->Set(String::New("time"), Date::New(evt->GetJavaDate()), ReadOnly); 590 ret->Set(String::New("qos"), Integer::New(evt->GetQoS()), ReadOnly); 594 ret->Set(String::New("qos"), Integer::New(evt->GetQoS()), ReadOnly); 595 ret->Set(String::New("size"), Integer::New(evt->GetSize()), ReadOnly); 591 596 592 597 typedef boost::char_separator<char> separator; … … 603 608 for (auto it=tok.begin(); it!=tok.end(); it++, pos++) 604 609 { 610 if (ptr>=evt->GetText()) 611 return handle_scope.Close(ret); 612 605 613 char type = (*it)[0]; 606 614 it++; -
trunk/FACT++/src/InterpreterV8.h
r14527 r14540 10 10 #endif 11 11 12 #include "State.h" 12 13 #include "Description.h" 13 14 #include "EventImp.h" … … 94 95 virtual void JsSleep(uint32_t) { } 95 96 virtual int JsWait(const std::string &, int32_t, uint32_t) { return -1; }; 96 virtual std::pair<int32_t, std::string> JsState(const std::string &) { return std::make_pair(-256, ""); };97 virtual State JsState(const std::string &) { return State(); }; 97 98 virtual void *JsSubscribe(const std::string &) { return 0; }; 98 99 virtual bool JsUnsubscribe(const std::string &) { return false; }; -
trunk/FACT++/src/RemoteControl.h
r14497 r14540 170 170 virtual void JsException(const std::string &str) { if (fImp) fImp->Error(str.empty()?" ":str); } 171 171 172 pair<int32_t, string>JsState(const std::string &server)173 { 174 return fImp ? fImp->GetServerState(server) : make_pair(-256, string());172 State JsState(const std::string &server) 173 { 174 return fImp ? fImp->GetServerState(server) : State(-256, string()); 175 175 } 176 176 … … 208 208 209 209 int rc = 0; 210 while (timeout>Time() && !T::IsScriptStopped())211 { 212 const pair<int32_t, string>st = fImp->GetServerState(server);213 if (st. first==-256)210 do 211 { 212 State st = fImp->GetServerState(server); 213 if (st.index==-256) 214 214 { 215 215 lout << kRed << "Server '" << server << "' disconnected." << endl; … … 217 217 return -1; 218 218 } 219 if (st. first==state)219 if (st.index==state) 220 220 { 221 221 rc = 1; … … 225 225 usleep(1); 226 226 } 227 while (timeout>Time() && !T::IsScriptStopped()); 228 227 229 T::Unlock(); 228 230
Note:
See TracChangeset
for help on using the changeset viewer.