Пример #1
0
bool PvaClientMonitor::waitEvent(double secondsToWait)
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientMonitor::waitEvent"
           << " channelName " << channelName
           << endl;
    }
    if(!isStarted) {
        Channel::shared_pointer chan(channel.lock());
        string channelName("disconnected");
        if(chan) channelName = chan->getChannelName();
        string message = string("channel ") + channelName
            + " PvaClientMonitor::waitEvent illegal state ";
        throw std::runtime_error(message);
    }
    if(poll()) return true;
    userWait = true;
    if(secondsToWait==0.0) {
        waitForEvent.wait();
    } else {
        waitForEvent.wait(secondsToWait);
    }
    userWait = false;
    return poll();
}
Пример #2
0
void PvaClientMonitor::releaseEvent()
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientMonitor::releaseEvent"
           << " channelName " << channelName
           << endl;
    }
    if(!isStarted) {
        Channel::shared_pointer chan(channel.lock());
        string channelName("disconnected");
        if(chan) channelName = chan->getChannelName();
        string message = string("channel ") + channelName
            + " PvaClientMonitor::releaseEvent monitor not started ";
        throw std::runtime_error(message);
    }
    if(!userPoll) {
        Channel::shared_pointer chan(channel.lock());
        string channelName("disconnected");
        if(chan) channelName = chan->getChannelName();
        string message = string("channel ") + channelName
            + " PvaClientMonitor::releaseEvent did not call poll";
        throw std::runtime_error(message);
    }
    userPoll = false;
    monitor->release(monitorElement);
}
Пример #3
0
bool PvaClientMonitor::poll()
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientMonitor::poll"
           << " channelName " << channelName
           << endl;
    }
    checkMonitorState();
    if(!isStarted) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        string message = string("channel ") + channelName
            + " PvaClientMonitor::poll illegal state ";
         throw std::runtime_error(message);
    }
    if(userPoll) {
                string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        string message = string("channel ") + channelName
            + " PvaClientMonitor::poll did not release last";
        throw std::runtime_error(message);
    }
    monitorElement = monitor->poll();
    if(!monitorElement) return false;
    userPoll = true;
    pvaClientData->setData(monitorElement);
   return true;
}
Пример #4
0
void PvaClientMonitor::start()
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientMonitor::start"
           << " channelName " << channelName
           << " connectState " << connectState
           << endl;
    }
    if(isStarted) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cerr << "PvaClientMonitor::start"
           << " channelName " << channelName
           << " why is this called twice "
           << endl;
        return;
    }
    if(connectState==connectIdle) connect();
    if(connectState!=connected) {
        Channel::shared_pointer chan(channel.lock());
        string channelName("disconnected");
        if(chan) channelName = chan->getChannelName();
        string message = string("channel ") + channelName
            + " PvaClientMonitor::start illegal state ";
        throw std::runtime_error(message);
    }
    isStarted = true;
    monitor->start();
}
Пример #5
0
/*
  install an alternative protocol handler. This allows another
  protocol to take over the link if MAVLink goes idle. It is used to
  allow for the AP_BLHeli pass-thru protocols to run on hal.uartA
 */
bool GCS::install_alternative_protocol(mavlink_channel_t c, GCS_MAVLINK::protocol_handler_fn_t handler)
{
    if (c >= num_gcs()) {
        return false;
    }
    if (chan(c).alternative.handler) {
        // already have one installed - we may need to add support for
        // multiple alternative handlers
        return false;
    }
    chan(c).alternative.handler = handler;
    return true;
}
NS_IMETHODIMP 
nsStreamLoader::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
{
  nsCOMPtr<nsIChannel> chan( do_QueryInterface(request) );
  if (chan) {
    int64_t contentLength = -1;
    chan->GetContentLength(&contentLength);
    if (contentLength >= 0) {
      if (contentLength > UINT32_MAX) {
        // Too big to fit into uint32, so let's bail.
        // XXX we should really make mAllocated and mLength 64-bit instead.
        return NS_ERROR_OUT_OF_MEMORY;
      }
      uint32_t contentLength32 = uint32_t(contentLength);
      // preallocate buffer
      mData = static_cast<uint8_t*>(NS_Alloc(contentLength32));
      if (!mData) {
        return NS_ERROR_OUT_OF_MEMORY;
      }
      mAllocated = contentLength32;
    }
  }
  mContext = ctxt;
  return NS_OK;
}
Пример #7
0
void PvaClientRPC::request(
    PVStructure::shared_pointer const & pvArgument,
    PvaClientRPCRequesterPtr const & pvaClientRPCRequester)
{
    checkRPCState();   
    this->pvaClientRPCRequester = pvaClientRPCRequester;
    if(responseTimeout<=0.0) {
         {
             Lock xx(mutex);
             if(rpcState!=rpcIdle) {
                 Channel::shared_pointer chan(channel.lock());
                 string channelName("disconnected");
                 if(chan) channelName = chan->getChannelName();
                 string message = "channel "
                    + channelName
                    + " PvaClientRPC::request request aleady active ";
                 throw std::runtime_error(message);
            }
            rpcState = rpcActive;
        }
        channelRPC->request(pvArgument);
        return;
    }
    request(pvArgument);
}
int main() {
	freopen("form.in","r",stdin);
	freopen("form.out","w",stdout);
	scanf("%d%d",&N,&M);
	null=new Splay;
	nullinit();
	seq=null;
	for (i=1;i<=N;++i) {
		scanf("%d",&a[i]);
		b[i]=a[i];
		mini(dist,abs(seq->closest(b[i])->data-b[i]));
		seq->ins(b[i]);
	}
	h[0]=N-1;
	for (i=1;i<N;++i) h[i]=abs(b[i]-a[i+1]),hh[i]=t[i]=i;
	t[N]=0;
	for (i=N-1;i;--i) down(i);
	char opt[14];
	int cnt=0;
	while (M--) {
		scanf("%s",opt);
		switch (opt[4]) {
			case 'R': scanf("%d%d",&i,&k);
				chan(t[i],abs(b[i]-k));
				b[i]=k;
				if (i<N) inse(abs((b[i])-a[i+1]),i);
				mini(dist,abs(k-seq->closest(k)->data));
				seq->ins(k);
				break;
			case 'G': ++cnt; printf("%d\n",h[1]); break;
			case 'S': ++cnt; printf("%d\n",dist); break;
		}
	}
}
Пример #9
0
/* static */ already_AddRefed<Image>
ImageFactory::CreateRasterImage(nsIRequest* aRequest,
                                imgStatusTracker* aStatusTracker,
                                const nsCString& aMimeType,
                                ImageURL* aURI,
                                uint32_t aImageFlags,
                                uint32_t aInnerWindowId)
{
  nsresult rv;

  nsRefPtr<RasterImage> newImage = new RasterImage(aStatusTracker, aURI);

  rv = newImage->Init(aMimeType.get(), aImageFlags);
  NS_ENSURE_SUCCESS(rv, BadImage(newImage));

  newImage->SetInnerWindowID(aInnerWindowId);

  uint32_t len = GetContentSize(aRequest);

  // Pass anything usable on so that the RasterImage can preallocate
  // its source buffer.
  if (len > 0) {
    uint32_t sizeHint = std::min<uint32_t>(len, 20000000); // Bound by something reasonable
    rv = newImage->SetSourceSizeHint(sizeHint);
    if (NS_FAILED(rv)) {
      // Flush memory, try to get some back, and try again.
      rv = nsMemory::HeapMinimize(true);
      nsresult rv2 = newImage->SetSourceSizeHint(sizeHint);
      // If we've still failed at this point, things are going downhill.
      if (NS_FAILED(rv) || NS_FAILED(rv2)) {
        NS_WARNING("About to hit OOM in imagelib!");
      }
    }
  }

  nsAutoCString ref;
  aURI->GetRef(ref);
  mozilla::net::nsMediaFragmentURIParser parser(ref);
  if (parser.HasResolution()) {
    newImage->SetRequestedResolution(parser.GetResolution());
  }

  if (parser.HasSampleSize()) {
      /* Get our principal */
      nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
      nsCOMPtr<nsIPrincipal> principal;
      if (chan) {
        nsContentUtils::GetSecurityManager()->GetChannelPrincipal(chan,
                                                                  getter_AddRefs(principal));
      }

      if ((principal &&
           principal->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED) ||
          gEnableMozSampleSize) {
        newImage->SetRequestedSampleSize(parser.GetSampleSize());
      }
  }

  return newImage.forget();
}
Пример #10
0
   int getRasterLayerStatistics(Layer* pLayer, uint32_t channel,
                                uint32_t component, struct RasterStatistics* pStatistics)
   {
      RasterLayer* pRaster = dynamic_cast<RasterLayer*>(pLayer);
      RasterChannelType chan(static_cast<RasterChannelTypeEnum>(channel));
      ComplexComponent comp(static_cast<ComplexComponentEnum>(component));
      if (pRaster == NULL || pStatistics == NULL || !chan.isValid() || !comp.isValid())
      {
         setLastError(SIMPLE_BAD_PARAMS);
         return 1;
      }
      Statistics* pStats = pRaster->getStatistics(chan);
      if (pStats == NULL || !pStats->areStatisticsCalculated(comp))
      {
         setLastError(SIMPLE_OTHER_FAILURE);
         return 1;
      }
      pStatistics->min = pStats->getMin(comp);
      pStatistics->max = pStats->getMax(comp);
      pStatistics->mean = pStats->getAverage(comp);
      pStatistics->stddev = pStats->getStandardDeviation(comp);
      const double* pTmp = NULL;
      const unsigned int* pTmp2 = NULL;
      pStats->getHistogram(pTmp, pTmp2, comp);
      pStatistics->pHistogramCenters = const_cast<double*>(pTmp);
      pStatistics->pHistogramCounts = const_cast<unsigned int*>(pTmp2);
      pStatistics->pPercentiles = const_cast<double*>(pStats->getPercentiles(comp));
      pStatistics->resolution = pStats->getStatisticsResolution();

      setLastError(SIMPLE_NO_ERROR);
      return 0;
   }
Пример #11
0
Status PvaClientMonitor::waitConnect()
{
    if(PvaClient::getDebug()) cout << "PvaClientMonitor::waitConnect\n";
    if(connectState==connected) {
         if(!connectStatus.isOK()) connectState = connectIdle;
         return connectStatus;
    }
    if(connectState!=connectActive) {
        Channel::shared_pointer chan(channel.lock());
        string channelName("disconnected");
        if(chan) channelName = chan->getChannelName();
        string message = string("channel ")
            + channelName
            + " PvaClientMonitor::waitConnect illegal connect state ";
        throw std::runtime_error(message);
    }
    if(PvaClient::getDebug()) {
        cout << "PvaClientMonitor::waitConnect calling waitForConnect.wait\n";
    }
    waitForConnect.wait();
    connectState = connectStatus.isOK() ? connected : connectIdle;
    if(PvaClient::getDebug()) {
        cout << "PvaClientMonitor::waitConnect"
             << " connectStatus " << (connectStatus.isOK() ? "connected" : "not connected");
    }
    return connectStatus;
}
Пример #12
0
void ServerState::addChannel(string& name, Channel* channel) {
    string lname = name;
    int size = lname.size();
    for (int i = 0; i < size; ++i) {
        lname[i] = (char) tolower(lname[i]);
    }
    ChannelPtr chan(channel);
    channelMap[lname] = chan;
}
Пример #13
0
PVStructure::shared_pointer PvaClientRPC::request(PVStructure::shared_pointer const & pvArgument)
{
    checkRPCState();
    {
        Lock xx(mutex);
        if(rpcState!=rpcIdle) {
            Channel::shared_pointer chan(channel.lock());
            string channelName("disconnected");
            if(chan) channelName = chan->getChannelName();
            string message = "channel "
                + channelName
                + " PvaClientRPC::request request aleady active ";
            throw std::runtime_error(message);
        }
        rpcState = rpcActive;
    }
    channelRPC->request(pvArgument);
    if(responseTimeout>0.0) {
        waitForDone.wait(responseTimeout);
    } else {
        waitForDone.wait();
    }
    Lock xx(mutex);
    if(rpcState!=rpcComplete) {
        Channel::shared_pointer chan(channel.lock());
            string channelName("disconnected");
            if(chan) channelName = chan->getChannelName();
        string message = "channel "
            + channelName
            + " PvaClientRPC::request request timeout ";
        throw RPCRequestException(Status::STATUSTYPE_ERROR,message);
    }
    rpcState = rpcIdle;
    if(requestStatus.isOK()) return pvResponse;
    Channel::shared_pointer chan(channel.lock());
    string channelName("disconnected");
    if(chan) channelName = chan->getChannelName();
    string message = "channel "
            + channelName
            + " PvaClientRPC::request status ";
    message += requestStatus.getMessage();
    throw RPCRequestException(Status::STATUSTYPE_ERROR,message);
}
Пример #14
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ ThrowRuntimeError
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Throws a VM error. Adds the channel that threw to the error message.
void CProgMoanChannel::ThrowRuntimeError(
    OSErr			inErr)
{
    StAEDescriptor		chan(mId);
    AERecord			context= {typeNull,0};

    UAEDesc::AddKeyDesc(&context,keyTBMoanChannel,chan);

    ThrowAEErr_(inErr,context);
}
Пример #15
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ ThrowUndefinedLabel
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Throws a VM error. Adds the channel that threw to the error message.
void CProgMoanChannel::ThrowUndefinedLabel(
    char				inLabel)
{
    StAEDescriptor		chan(mId),label(typeText,&inLabel,sizeof(char));
    AERecord			context= {typeNull,0};

    UAEDesc::AddKeyDesc(&context,keyTBMoanChannel,chan);
    UAEDesc::AddKeyDesc(&context,keyTBVarName,label);

    ThrowAEErr_(kTBErr_UndefinedMoanLabel,context);
}
Пример #16
0
void WaveConfigPopout::SaveChannel(UInt_t chNum)
{
    ChannelConfig chan(fBEnabled->GetState(),
		       fNEntryOffset->GetNumber(),
		       fNEntryChThreshold->GetNumber(),
		       (ChannelTrigger)fCBChTrig->GetSelected());
    if(chNum == 0)
	config.setGlobalChan(chan);
    else
	config.addChannel(chNum-1, chan);
}
Пример #17
0
PvaClientRPC::~PvaClientRPC()
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout<< "PvaClientRPC::~PvaClientRPC"
           << " channelName " << channelName
           << endl;
    }
}
Пример #18
0
void PvaClientMonitor::setRequester(PvaClientMonitorRequesterPtr const & pvaClientMonitorRequester)
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientMonitor::setRequester"
           << " channelName " << channelName
           << endl;
    }
    this->pvaClientMonitorRequester = pvaClientMonitorRequester;
}
Пример #19
0
void PvaClientMonitor::monitorConnect(
    const Status& status,
    Monitor::shared_pointer const & monitor,
    StructureConstPtr const & structure)
{
    Channel::shared_pointer chan(channel.lock());
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientMonitor::monitorConnect"
           << " channelName " << channelName
           << " status.isOK " << (status.isOK() ? "true" : "false")
           << endl;
    }
    connectStatus = status;
    connectState = connected;
    this->monitor = monitor;
    if(isStarted) {
        if(PvaClient::getDebug()) {
            string channelName("disconnected");
            Channel::shared_pointer chan(channel.lock());
            if(chan) channelName = chan->getChannelName();
            cout << "PvaClientMonitor::monitorConnect"
               << " channelName " << channelName
               << " is already started "
               << endl;
        }
        return;
    }
    if(status.isOK() && chan) {
        pvaClientData = PvaClientMonitorData::create(structure);
        pvaClientData->setMessagePrefix(chan->getChannelName());
    }
    if(PvaClient::getDebug()) {
         cout << "PvaClientMonitor::monitorConnect calling waitForConnect.signal\n";
    }
    waitForConnect.signal();
    
}
Пример #20
0
PvaClientMonitorDataPtr PvaClientMonitor::getData()
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientMonitor::getData"
           << " channelName " << channelName
           << endl;
    }
    checkMonitorState();
    return pvaClientData;
}
Пример #21
0
void PvaClientMonitor::unlisten(MonitorPtr const & monitor)
{
    if(PvaClient::getDebug()) cout << "PvaClientMonitor::unlisten\n";
    PvaClientMonitorRequesterPtr req = pvaClientMonitorRequester.lock();
    if(req) {
        req->unlisten();
        return;
    }
    string channelName("disconnected");
    Channel::shared_pointer chan(channel.lock());
    if(chan) channelName = chan->getChannelName();
    cerr << channelName + "pvaClientMonitor::unlisten called but no PvaClientMonitorRequester\n";
}
Пример #22
0
void PvaClientRPC::requestDone(
        const Status& status,
        ChannelRPC::shared_pointer const & channelRPC,
        PVStructure::shared_pointer const & pvResponse)
{
    PvaClientRPCRequesterPtr req = pvaClientRPCRequester.lock();
    {
        Lock xx(mutex);
        requestStatus = status;
        if(PvaClient::getDebug()) {
             string channelName("disconnected");
             Channel::shared_pointer chan(channel.lock());
             if(chan) channelName = chan->getChannelName();
             cout << "PvaClientRPC::requestDone"
                  << " channelName " << channelName
                  << endl;
        }
        if(rpcState!=rpcActive) {
             string channelName("disconnected");
             Channel::shared_pointer chan(channel.lock());
             if(chan) channelName = chan->getChannelName();
             string message = "channel "
                 + channelName 
                 +" PvaClientRPC::requestDone"
                 + " but not active";
             throw std::runtime_error(message);
        }
        if(req && (responseTimeout<=0.0)) {
            rpcState = rpcIdle;
        } else {
            rpcState = rpcComplete;
            if(!req) this->pvResponse = pvResponse;
            waitForDone.signal();
        }
    }
    if(req) {
        req->requestDone(status,shared_from_this(),pvResponse);
    }
}
Пример #23
0
struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args)
{
	if (mountpoint==NULL || strlen(mountpoint)==0) return NULL;

	std::auto_ptr<fuse_chan> chan(new fuse_chan());
	//NOTE: we used to do chan->init() here to check that Dokan DLLs can be loaded.
	//However, this does not live well with Cygwin. It's common for filesystem drivers
	//to daemon()ize themselves (which involves fork() call) and forking doesn't work
	//with Dokan. So defer loading until the main loop.
	
	chan->mountpoint=mountpoint;
	return chan.release();
}
Пример #24
0
void PvaClientRPC::checkRPCState()
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientRPC::checkRPCState"
           << " channelName " << channelName
           << " connectState " << connectState
           << endl;
    }
    if(connectState==connectIdle) connect();
}
Пример #25
0
void PvaClientMonitor::stop()
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientMonitor::stop"
           << " channelName " << channelName
           << endl;
    }
    if(!isStarted) return;
    isStarted = false;
    monitor->stop();
}
Пример #26
0
bool ScanDTVTransport::FillFromDB(DTVTunerType type, uint mplexid)
{
    if (!DTVMultiplex::FillFromDB(type, mplexid))
        return false;

    MSqlQuery query(MSqlQuery::InitCon());
    query.prepare(
        "SELECT c.mplexid,       c.sourceid,        c.chanid,          "
        "       c.callsign,      c.name,            c.channum,         "
        "       c.serviceid,     c.atsc_major_chan, c.atsc_minor_chan, "
        "       c.useonairguide, c.visible,         c.freqid,          "
        "       c.icon,          c.tvformat,        c.xmltvid,         "
        "       d.transportid,   d.networkid,       c.default_authority "
        "FROM channel AS c, dtv_multiplex AS d "
        "WHERE c.mplexid = :MPLEXID AND"
        "      c.mplexid = d.mplexid");
    query.bindValue(":MPLEXID", mplexid);

    if (!query.exec())
    {
        MythDB::DBError("ScanDTVTransport::FillFromDB", query);
        return false;
    }

    while (query.next())
    {
        ChannelInsertInfo chan(
            query.value(0).toUInt(),     query.value(1).toUInt(),
            query.value(2).toUInt(),     query.value(3).toString(),
            query.value(4).toString(),   query.value(5).toString(),
            query.value(6).toUInt(),
            query.value(7).toUInt(),     query.value(8).toUInt(),
            query.value(9).toUInt(),    !query.value(10).toUInt(),
            false,
            query.value(11).toString(),  query.value(12).toString(),
            query.value(13).toString(),  query.value(14).toString(),
            0, 0, 0,
            query.value(15).toUInt(),    query.value(16).toUInt(),
            0,
            QString::null,
            false, false, false, false,
            false, false, false, false,
            false, false, false, 0,
            query.value(17).toString() /* default_authority */);

        channels.push_back(chan);
    }

    return true;
}
Пример #27
0
void PvaClientMonitor::monitorEvent(MonitorPtr const & monitor)
{
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientMonitor::monitorEvent"
           << " channelName " << channelName
           << endl;
    }    
    PvaClientMonitorRequesterPtr req = pvaClientMonitorRequester.lock();
    if(req) req->event(shared_from_this());
    if(userWait) waitForEvent.signal();
}
Пример #28
0
void PvaClientRPC::rpcConnect(
    const Status& status,
    ChannelRPC::shared_pointer const & channelRPC)
{
    Channel::shared_pointer chan(channel.lock());
    if(PvaClient::getDebug()) {
        string channelName("disconnected");
        Channel::shared_pointer chan(channel.lock());
        if(chan) channelName = chan->getChannelName();
        cout << "PvaClientRPC::rpcConnect"
           << " channelName " << channelName
           << " status.isOK " << (status.isOK() ? "true" : "false")
           << endl;
    }
    if(!chan) return;
    connectStatus = status;
    connectState = connected;
    if(PvaClient::getDebug()) {
         cout << "PvaClientRPC::rpcConnect calling waitForConnect.signal\n";
    }
    waitForConnect.signal();
    
}
Пример #29
0
void PvaClientMonitor::connect()
{
    if(PvaClient::getDebug()) cout << "PvaClientMonitor::connect\n";
    issueConnect();
    Status status = waitConnect();
    if(status.isOK()) return;
    Channel::shared_pointer chan(channel.lock());
    string channelName("disconnected");
    if(chan) channelName = chan->getChannelName();
    string message = string("channel ") 
        + channelName
        + " PvaClientMonitor::connect "
        + status.getMessage();
    throw std::runtime_error(message);
}
Пример #30
0
void PvaClientRPC::connect()
{
    if(PvaClient::getDebug()) cout << "PvaClientRPC::connect\n";
    issueConnect();
    Status status = waitConnect();
    if(status.isOK()) return;
    Channel::shared_pointer chan(channel.lock());
    string channelName("disconnected");
    if(chan) channelName = chan->getChannelName();
    string message = string("channel ") 
        + channelName
        + " PvaClientRPC::connect "
        + status.getMessage();
    throw RPCRequestException(Status::STATUSTYPE_ERROR,message);
}