bool RemotePlugin::processMessage( const message & _m ) { lock(); message reply_message( _m.id ); bool reply = false; switch( _m.id ) { case IdUndefined: unlock(); return false; case IdInitDone: reply = true; break; case IdSampleRateInformation: reply = true; reply_message.addInt( Engine::mixer()->processingSampleRate() ); break; case IdBufferSizeInformation: reply = true; reply_message.addInt( Engine::mixer()->framesPerPeriod() ); break; case IdChangeInputCount: m_inputCount = _m.getInt( 0 ); resizeSharedProcessingMemory(); break; case IdChangeOutputCount: m_outputCount = _m.getInt( 0 ); resizeSharedProcessingMemory(); break; case IdChangeInputOutputCount: m_inputCount = _m.getInt( 0 ); m_outputCount = _m.getInt( 1 ); resizeSharedProcessingMemory(); break; case IdDebugMessage: fprintf( stderr, "RemotePlugin::DebugMessage: %s", _m.getString( 0 ).c_str() ); break; case IdProcessingDone: case IdQuit: default: break; } if( reply ) { sendMessage( reply_message ); } unlock(); return true; }
/* determine accessibility of a file */ void msg_access(message_t msg) { int ret; ret = vfs_access(msg->tid, msg->snd_ptr, msg->w4); msg->w1 = ret; reply_message(msg->tid, msg); }
/* * Return value is kept in the same buf. */ void msg_exec(message_t msg) { /* * Return value is kept in the same buf. */ msg->w1 = do_exec(msg->tid, (char *)msg->snd_ptr, (struct vn_object *)msg->rcv_ptr); reply_message(msg->tid, msg); }
void msg_read(message_t msg) { int ret; ret = vfs_read(msg->tid, msg->w2, msg->rcv_ptr, msg->rcv_bufsize); msg->w1 = ret; reply_message(msg->tid, msg); }
void msg_write(message_t msg) { int ret; ret = vfs_write(msg->tid, msg->w4, msg->snd_ptr, msg->snd_bufsize); msg->w1 = ret; reply_message(msg->tid, msg); }
/* close the file */ void msg_close(message_t msg) { int ret; ret = vfs_close(msg->tid, msg->w4); msg->w1 = ret; reply_message(msg->tid, msg); }
void reply_handler( const std::string& method, const std::string& reply ) { if ( method == "InitialSetup" ) { reply_message( adi::Receiver::STATE_CHANGED, ( reply == "success" ) ? adi::Instrument::eStandBy : adi::Instrument::eOff ); } else { adacquire::EventLog::LogMessage mlog( "%1%", method, "AP240" ); mlog << reply; for ( auto& r: clients_ ) r.first->log( mlog ); } }
/* open a file */ void msg_open(message_t msg) { int ret; ret = vfs_open(msg->tid, (char *)msg->snd_ptr, (int *)&msg->w4, 0); msg->w1 = ret; // printf("reply %d ", msg->tid); // for(;;); reply_message(msg->tid, msg); }
void reply_handler( const std::string& method, const std::string& reply) { if ( method == "InitialSetup" ) { reply_message( adacquire::Receiver::STATE_CHANGED , ( reply == "success" ) ? adacquire::Instrument::eStandBy : adacquire::Instrument::eNotConnected | adacquire::Instrument::eErrorFlag ); } else if ( method == "StateChanged" ) { if ( reply == "Stopped" ) reply_message( adacquire::Receiver::STATE_CHANGED, adacquire::Instrument::eStop ); // 9 else if ( reply == "Running" ) reply_message( adacquire::Receiver::STATE_CHANGED, adacquire::Instrument::eRunning ); // 8 } else if ( method == "DarkStarted" ) { reply_message( adacquire::Receiver::DARK_STARTED, 1 ); } else if ( method == "DarkCanceled" ) { reply_message( adacquire::Receiver::DARK_CANCELED, 0 ); } else if ( method == "DarkAcquired" ) { reply_message( adacquire::Receiver::DARK_ACQUIRED, 0 ); } else { ADINFO() << "ACQUIRE: " << method << " = " << reply; } }
/* Chown */ void msg_chown(message_t msg) { msg->w1 = vfs_chown(msg->tid, msg->snd_ptr, msg->w4, msg->w5); reply_message(msg->tid, msg); }
void msg_chdir(message_t msg) { msg->w1 = fs_chdir(msg->tid, msg->snd_ptr); reply_message(msg->tid, msg); }
void msg_data_req(message_t msg) { msg->w1 = data_request(msg->tid, msg->snd_ptr, msg->rcv_ptr); reply_message(msg->tid, msg); }
/* fstat */ void msg_fstat(message_t msg) { msg->w1 = vfs_fstat(msg->tid, msg->w2, msg->rcv_ptr); reply_message(msg->tid, msg); }
/* stat */ void msg_stat(message_t msg) { msg->w1 = vfs_chmod(msg->tid, msg->snd_ptr, msg->rcv_ptr); reply_message(msg->tid, msg); }
/* Chmod */ void msg_chmod(message_t msg) { msg->w1 = vfs_chmod(msg->tid, msg->snd_ptr, msg->w4); reply_message(msg->tid, msg); }