Subversion Repositories HomeAutomation

Rev

Rev 1986 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1986 Rev 1987
Line 116... Line 116...
116
 
116
 
117
  try
117
  try
118
  {
118
  {
119
    ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList);
119
    ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList);
120
   
120
   
121
    if (data.GetSize() == 0)
121
    if (data.size() == 0)
122
    {
122
    {
123
        atom::log::Error(log_module_, "Got empty data!");
123
        atom::log::Error(log_module_, "Got empty data!");
124
        return;
124
        return;
125
    }
125
    }
126
   
126
   
127
    arguments->push_back(v8::Integer::New(boost::lexical_cast<unsigned int>(id)));
127
    arguments->push_back(v8::Integer::New(boost::lexical_cast<unsigned int>(id)));
128
    arguments->push_back(v8::String::New(data.ToCharString().c_str()));
128
    arguments->push_back(v8::String::New(std::string(data.begin(), data.end()).data()));
129
       
129
       
130
    if (!this->Call(id, "Socket_OnNewData", arguments))
130
    if (!this->Call(id, "Socket_OnNewData", arguments))
131
    {
131
    {
132
      atom::log::Error(log_module_, "%s failed!", __FUNCTION__);
132
      atom::log::Error(log_module_, "%s failed!", __FUNCTION__);
133
    }
133
    }
Line 317... Line 317...
317
   
317
   
318
    v8::String::AsciiValue data(args[1]);
318
    v8::String::AsciiValue data(args[1]);
319
 
319
 
320
    atom::log::Debug(log_module_, "Socket %u send %s", args[0]->Uint32Value(), *data);
320
    atom::log::Debug(log_module_, "Socket %u send %s", args[0]->Uint32Value(), *data);
321
   
321
   
-
 
322
    std::string data_string(*data);
-
 
323
   
322
    net::Manager::Instance()->SendTo(args[0]->Uint32Value(), std::string(*data));
324
    net::Manager::Instance()->SendTo(args[0]->Uint32Value(), common::Byteset(data_string.begin(), data_string.end()));
323
  }
325
  }
324
  catch (std::exception& exception)
326
  catch (std::exception& exception)
325
  {
327
  {
326
    atom::log::Exception(log_module_, exception);
328
    atom::log::Exception(log_module_, exception);
327
    return handle_scope.Close(v8::Boolean::New(false));
329
    return handle_scope.Close(v8::Boolean::New(false));