• Home
  • Raw
  • Download

Lines Matching refs:hSession

397     HSession hSession = (HSession)stream->data;  in UartToHdcProtocol()  local
398 unsigned int fd = hSession->dataFd[STREAM_MAIN]; in UartToHdcProtocol()
441 RetErrCode HdcUARTBase::DispatchToWorkThread(HSession hSession, uint8_t *readBuf, int readBytes) in DispatchToWorkThread() argument
443 if (hSession == nullptr) { in DispatchToWorkThread()
446 if (!UartSendToHdcStream(hSession, readBuf, readBytes)) { in DispatchToWorkThread()
452 size_t HdcUARTBase::PackageProcess(vector<uint8_t> &data, HSession hSession) in PackageProcess() argument
473 if (hSession == nullptr) { in PackageProcess()
475 hSession = GetSession(sessionId); in PackageProcess()
478 hSession = GetSession(sessionId, true); in PackageProcess()
481 if (hSession == nullptr) { in PackageProcess()
484 if (hSession->hUART->dispatchedPackageIndex == packageIndex) { in PackageProcess()
490 hSession->hUART->dispatchedPackageIndex = packageIndex; in PackageProcess()
491 RetErrCode ret = DispatchToWorkThread(hSession, data.data(), packetSize); in PackageProcess()
502 ResponseUartTrans(hSession->sessionId, ++hSession->hUART->packageIndex, in PackageProcess()
525 bool HdcUARTBase::SendUARTRaw(HSession hSession, uint8_t *data, const size_t length) in SendUARTRaw() argument
541 if (hSession == nullptr) { in SendUARTRaw()
542 hSession = GetSession(uartHeader->sessionId); in SendUARTRaw()
543 if (hSession == nullptr) { in SendUARTRaw()
549 hSession->ref++; in SendUARTRaw()
552 ssize_t sendBytes = WriteUartDev(data, length, *hSession->hUART); in SendUARTRaw()
559 OnTransferError(hSession); in SendUARTRaw()
561 hSession->ref--; in SendUARTRaw()
567 bool HdcUARTBase::UartSendToHdcStream(HSession hSession, uint8_t *data, size_t size) in UartSendToHdcStream() argument
570 hSession->ToDebugString().c_str(), size); in UartSendToHdcStream()
585 if (head->sessionId != hSession->sessionId) { in UartSendToHdcStream()
586 if (hSession->serverOrDaemon && !hSession->hUART->resetIO) { in UartSendToHdcStream()
589 SendUartSoftReset(hSession, head->sessionId); in UartSendToHdcStream()
590 hSession->hUART->resetIO = true; in UartSendToHdcStream()
596 hSession->hUART->streamSize += head->dataSize; // this is only for debug, in UartSendToHdcStream()
598 hSession->hUART->streamSize.load()); in UartSendToHdcStream()
599 if (UartToHdcProtocol(reinterpret_cast<uv_stream_t *>(&hSession->dataPipe[STREAM_MAIN]), in UartSendToHdcStream()
895 int HdcUARTBase::SendUARTData(HSession hSession, uint8_t *data, const size_t length) in SendUARTData() argument
898 WRITE_LOG(LOG_DEBUG, "SendUARTData hSession:%u, total length:%d", hSession->sessionId, length); in SendUARTData()
914 head->sessionId = hSession->sessionId; in SendUARTData()
915 head->packageIndex = ++hSession->hUART->packageIndex; in SendUARTData()
948 HSession hSession = (HSession)stream->data; in ReadDataFromUARTStream() local
949 HdcUARTBase *hUARTBase = (HdcUARTBase *)hSession->classModule; in ReadDataFromUARTStream()
958 hSession->sessionId, nread, buffer, in ReadDataFromUARTStream()
959 hSession->hUART->streamSize.load()); in ReadDataFromUARTStream()
960 HdcSessionBase *hSessionBase = (HdcSessionBase *)hSession->classInstance; in ReadDataFromUARTStream()
961 if (nread <= 0 or nread > signed(hSession->hUART->streamSize)) { in ReadDataFromUARTStream()
965 if (hSessionBase->FetchIOBuf(hSession, hSession->ioBuf, nread) < 0) { in ReadDataFromUARTStream()
969 hUARTBase->ResponseUartTrans(hSession->sessionId, ++hSession->hUART->packageIndex, in ReadDataFromUARTStream()
973 hSessionBase->FreeSession(hSession->sessionId); in ReadDataFromUARTStream()
975 hSession->hUART->streamSize -= nread; in ReadDataFromUARTStream()
976 WRITE_LOG(LOG_DEBUG, "%s sessionId:%u, nread:%d", __FUNCTION__, hSession->sessionId, nread); in ReadDataFromUARTStream()
979 bool HdcUARTBase::ReadyForWorkThread(HSession hSession) in ReadyForWorkThread() argument
981 if (externInterface.UvTcpInit(&hSession->childLoop, &hSession->dataPipe[STREAM_WORK], in ReadyForWorkThread()
982 hSession->dataFd[STREAM_WORK])) { in ReadyForWorkThread()
986 hSession->dataPipe[STREAM_WORK].data = hSession; in ReadyForWorkThread()
987 HdcSessionBase *pSession = (HdcSessionBase *)hSession->classInstance; in ReadyForWorkThread()
988 externInterface.SetTcpOptions(&hSession->dataPipe[STREAM_WORK]); in ReadyForWorkThread()
989 if (externInterface.UvRead((uv_stream_t *)&hSession->dataPipe[STREAM_WORK], in ReadyForWorkThread()
1007 void HdcUARTBase::StopSession(HSession hSession) in StopSession() argument
1009 if (hSession != nullptr) { in StopSession()
1010 WRITE_LOG(LOG_WARN, "%s:%s", __FUNCTION__, hSession->ToDebugString().c_str()); in StopSession()
1011 ClearUARTOutMap(hSession->sessionId); in StopSession()