• Home
  • Raw
  • Download

Lines Matching refs:hSession

395     HSession hSession = (HSession)stream->data;  in UartToHdcProtocol()  local
396 unsigned int fd = hSession->dataFd[STREAM_MAIN]; in UartToHdcProtocol()
439 RetErrCode HdcUARTBase::DispatchToWorkThread(HSession hSession, uint8_t *readBuf, int readBytes) in DispatchToWorkThread() argument
441 if (hSession == nullptr) { in DispatchToWorkThread()
444 if (!UartSendToHdcStream(hSession, readBuf, readBytes)) { in DispatchToWorkThread()
450 size_t HdcUARTBase::PackageProcess(vector<uint8_t> &data, HSession hSession) in PackageProcess() argument
471 if (hSession == nullptr) { in PackageProcess()
473 hSession = GetSession(sessionId); in PackageProcess()
476 hSession = GetSession(sessionId, true); in PackageProcess()
479 if (hSession == nullptr) { in PackageProcess()
482 if (hSession->hUART->dispatchedPackageIndex == packageIndex) { in PackageProcess()
488 hSession->hUART->dispatchedPackageIndex = packageIndex; in PackageProcess()
489 RetErrCode ret = DispatchToWorkThread(hSession, data.data(), packetSize); in PackageProcess()
500 ResponseUartTrans(hSession->sessionId, ++hSession->hUART->packageIndex, in PackageProcess()
523 bool HdcUARTBase::SendUARTRaw(HSession hSession, uint8_t *data, const size_t length) in SendUARTRaw() argument
539 if (hSession == nullptr) { in SendUARTRaw()
540 hSession = GetSession(uartHeader->sessionId); in SendUARTRaw()
541 if (hSession == nullptr) { in SendUARTRaw()
547 hSession->ref++; in SendUARTRaw()
550 ssize_t sendBytes = WriteUartDev(data, length, *hSession->hUART); in SendUARTRaw()
557 OnTransferError(hSession); in SendUARTRaw()
559 hSession->ref--; in SendUARTRaw()
565 bool HdcUARTBase::UartSendToHdcStream(HSession hSession, uint8_t *data, size_t size) in UartSendToHdcStream() argument
568 hSession->ToDebugString().c_str(), size); in UartSendToHdcStream()
583 if (head->sessionId != hSession->sessionId) { in UartSendToHdcStream()
584 if (hSession->serverOrDaemon && !hSession->hUART->resetIO) { in UartSendToHdcStream()
587 SendUartSoftReset(hSession, head->sessionId); in UartSendToHdcStream()
588 hSession->hUART->resetIO = true; in UartSendToHdcStream()
594 hSession->hUART->streamSize += head->dataSize; // this is only for debug, in UartSendToHdcStream()
596 hSession->hUART->streamSize.load()); in UartSendToHdcStream()
597 if (UartToHdcProtocol(reinterpret_cast<uv_stream_t *>(&hSession->dataPipe[STREAM_MAIN]), in UartSendToHdcStream()
893 int HdcUARTBase::SendUARTData(HSession hSession, uint8_t *data, const size_t length) in SendUARTData() argument
896 WRITE_LOG(LOG_DEBUG, "SendUARTData hSession:%u, total length:%d", hSession->sessionId, length); in SendUARTData()
912 head->sessionId = hSession->sessionId; in SendUARTData()
913 head->packageIndex = ++hSession->hUART->packageIndex; in SendUARTData()
946 HSession hSession = (HSession)stream->data; in ReadDataFromUARTStream() local
947 HdcUARTBase *hUARTBase = (HdcUARTBase *)hSession->classModule; in ReadDataFromUARTStream()
956 hSession->sessionId, nread, buffer, in ReadDataFromUARTStream()
957 hSession->hUART->streamSize.load()); in ReadDataFromUARTStream()
958 HdcSessionBase *hSessionBase = (HdcSessionBase *)hSession->classInstance; in ReadDataFromUARTStream()
959 if (nread <= 0 or nread > signed(hSession->hUART->streamSize)) { in ReadDataFromUARTStream()
963 if (hSessionBase->FetchIOBuf(hSession, hSession->ioBuf, nread) < 0) { in ReadDataFromUARTStream()
967 hUARTBase->ResponseUartTrans(hSession->sessionId, ++hSession->hUART->packageIndex, in ReadDataFromUARTStream()
971 hSessionBase->FreeSession(hSession->sessionId); in ReadDataFromUARTStream()
973 hSession->hUART->streamSize -= nread; in ReadDataFromUARTStream()
974 WRITE_LOG(LOG_DEBUG, "%s sessionId:%u, nread:%d", __FUNCTION__, hSession->sessionId, nread); in ReadDataFromUARTStream()
977 bool HdcUARTBase::ReadyForWorkThread(HSession hSession) in ReadyForWorkThread() argument
979 if (externInterface.UvTcpInit(&hSession->childLoop, &hSession->dataPipe[STREAM_WORK], in ReadyForWorkThread()
980 hSession->dataFd[STREAM_WORK])) { in ReadyForWorkThread()
984 hSession->dataPipe[STREAM_WORK].data = hSession; in ReadyForWorkThread()
985 HdcSessionBase *pSession = (HdcSessionBase *)hSession->classInstance; in ReadyForWorkThread()
986 externInterface.SetTcpOptions(&hSession->dataPipe[STREAM_WORK]); in ReadyForWorkThread()
987 if (externInterface.UvRead((uv_stream_t *)&hSession->dataPipe[STREAM_WORK], in ReadyForWorkThread()
1005 void HdcUARTBase::StopSession(HSession hSession) in StopSession() argument
1007 if (hSession != nullptr) { in StopSession()
1008 WRITE_LOG(LOG_WARN, "%s:%s", __FUNCTION__, hSession->ToDebugString().c_str()); in StopSession()
1009 ClearUARTOutMap(hSession->sessionId); in StopSession()