Lines Matching refs:hSession

44 bool HdcHostUART::NeedStop(const HSession hSession)

46 return (!uartOpened or (hSession->isDead and hSession->ref == 0));
75 void HdcHostUART::UartReadThread(HSession hSession)
77 HUART hUART = hSession->hUART;
83 if (NeedStop(hSession)) {
90 OnTransferError(hSession);
108 expectedSize = PackageProcess(dataReadBuf, hSession);
417 void HdcHostUART::UpdateUARTDaemonInfo(const std::string &connectKey, HSession hSession,
426 diNew.hSession = hSession;
429 hSession == nullptr ? "<null>" : hSession->ToDebugString().c_str(), connStatus);
432 if (hSession != nullptr and hSession->hUART != nullptr) {
433 connectedPorts.erase(hSession->hUART->serialPort);
437 if (hSession != nullptr and hSession->hUART != nullptr) {
438 connectedPorts.emplace(hSession->hUART->serialPort);
452 bool HdcHostUART::StartUartReadThread(HSession hSession)
455 HUART hUART = hSession->hUART;
456 hUART->readThread = std::thread([this, hSession]() { this->UartReadThread(hSession); });
458 server.FreeSession(hSession->sessionId);
459 UpdateUARTDaemonInfo(hSession->connectKey, hSession, STATUS_UNKNOW);
483 HSession HdcHostUART::ConnectDaemonByUart(const HSession hSession, const HDaemonInfo)
489 HUART hUART = hSession->hUART;
490 UpdateUARTDaemonInfo(hSession->connectKey, hSession, STATUS_READY);
492 if (!StartUartReadThread(hSession)) {
498 Base::FinishWorkThread, hSession);
500 while (hSession->childLoop.active_handles == 0) {
504 externInterface.SendToPollFd(hSession->ctrlFd[STREAM_MAIN], ctrl.data(), ctrl.size());
505 return hSession;
559 if (hdi != nullptr and hdi->hSession == nullptr) {
578 HSession hSession = server.MallocSession(true, CONN_SERIAL, this);
579 if (!hSession) {
583 hSession->connectKey = connectKey;
585 hSession->hUART->devUartHandle = hUART->devUartHandle;
587 hSession->hUART->devUartHandle = hUART->devUartHandle;
590 hSession->isCheck = isCheck;
591 hSession->hUART->serialPort = hUART->serialPort;
592 WRITE_LOG(LOG_DEBUG, "%s connectkey:%s,port:%s", __FUNCTION__, Hdc::MaskString(hSession->connectKey).c_str(),
597 server.FreeSession(hSession->sessionId);
601 waitTimeDoCmd->data = hSession;
604 WRITE_LOG(LOG_DEBUG, "%s for %s:%s fail.", __FUNCTION__, Hdc::MaskString(hSession->connectKey).c_str(),
606 server.FreeSession(hSession->sessionId);
614 void HdcHostUART::KickoutZombie(HSession hSession)
616 if (hSession == nullptr or hSession->hUART == nullptr or hSession->isDead) {
620 if (hSession->hUART->devUartHandle == INVALID_HANDLE_VALUE) {
624 if (hSession->hUART->devUartHandle < 0) {
628 WRITE_LOG(LOG_DEBUG, "%s FreeSession %s", __FUNCTION__, hSession->ToDebugString().c_str());
629 server.FreeSession(hSession->sessionId);
691 void HdcHostUART::StopSession(HSession hSession)
693 if (hSession == nullptr) {
694 WRITE_LOG(LOG_FATAL, "%s hSession is null", __FUNCTION__);
697 WRITE_LOG(LOG_DEBUG, "%s hSession %s will be stop and free", __FUNCTION__,
698 hSession->ToDebugString().c_str());
699 HUART hUART = hSession->hUART;
720 HdcUARTBase::StopSession(hSession);
770 void HdcHostUART::SendUartSoftReset(HSession hSession, uint32_t sessionId)