Lines Matching refs:hSession
32 HSession hSession = (HSession)stream->data; in ReadUSB() local
33 HdcSessionBase *hSessionBase = (HdcSessionBase *)hSession->classInstance; in ReadUSB()
34 if (hSessionBase->FetchIOBuf(hSession, hSession->ioBuf, nread) < 0) { in ReadUSB()
35 WRITE_LOG(LOG_FATAL, "ReadUSB FetchIOBuf error sessionId:%u", hSession->sessionId); in ReadUSB()
36 hSessionBase->FreeSession(hSession->sessionId); in ReadUSB()
40 bool HdcUSBBase::ReadyForWorkThread(HSession hSession) in ReadyForWorkThread() argument
44 if (uv_tcp_init(&hSession->childLoop, &hSession->dataPipe[STREAM_WORK]) || in ReadyForWorkThread()
45 uv_tcp_open(&hSession->dataPipe[STREAM_WORK], hSession->dataFd[STREAM_WORK])) { in ReadyForWorkThread()
49 hSession->dataPipe[STREAM_WORK].data = hSession; in ReadyForWorkThread()
50 HdcSessionBase *pSession = (HdcSessionBase *)hSession->classInstance; in ReadyForWorkThread()
52 Base::SetTcpOptions(&hSession->dataPipe[STREAM_WORK], HOST_SOCKETPAIR_SIZE); in ReadyForWorkThread()
54 Base::SetTcpOptions(&hSession->dataPipe[STREAM_WORK]); in ReadyForWorkThread()
56 …if (uv_read_start((uv_stream_t *)&hSession->dataPipe[STREAM_WORK], pSession->AllocCallback, ReadUS… in ReadyForWorkThread()
61 hSession->dataFd[STREAM_WORK]); in ReadyForWorkThread()
81 int HdcUSBBase::SendUSBBlock(HSession hSession, uint8_t *data, const int length) in SendUSBBlock() argument
86 std::lock_guard<std::mutex> lock(hSession->hUSB->lockSendUsbBlock); in SendUSBBlock()
87 auto header = BuildPacketHeader(hSession->sessionId, USB_OPTION_HEADER, length); in SendUSBBlock()
89 if ((SendUSBRaw(hSession, header.data(), header.size())) <= 0) { in SendUSBBlock()
93 if ((childRet = SendUSBRaw(hSession, data, length)) <= 0) { in SendUSBBlock()
97 if (childRet > 0 && (childRet % hSession->hUSB->wMaxPacketSizeSend == 0)) { in SendUSBBlock()
100 auto dummy = BuildPacketHeader(hSession->sessionId, 0, 0); in SendUSBBlock()
101 if ((SendUSBRaw(hSession, dummy.data(), dummy.size())) <= 0) { in SendUSBBlock()
137 void HdcUSBBase::PreSendUsbSoftReset(HSession hSession, uint32_t sessionIdOld) in PreSendUsbSoftReset() argument
140 HUSB hUSB = hSession->hUSB; in PreSendUsbSoftReset()
141 if (hSession->serverOrDaemon && !hUSB->resetIO) { in PreSendUsbSoftReset()
145 if (SendUSBRaw(hSession, header.data(), header.size()) <= 0) { in PreSendUsbSoftReset()
153 int HdcUSBBase::CheckPacketOption(HSession hSession, uint8_t *appendData, int dataSize) in CheckPacketOption() argument
155 HUSB hUSB = hSession->hUSB; in CheckPacketOption()
160 if (header->sessionId != hSession->sessionId) { in CheckPacketOption()
167 header->sessionId, hSession->sessionId); in CheckPacketOption()
168 PreSendUsbSoftReset(hSession, header->sessionId); in CheckPacketOption()
180 int HdcUSBBase::SendToHdcStream(HSession hSession, uv_stream_t *stream, uint8_t *appendData, int da… in SendToHdcStream() argument
184 HUSB hUSB = hSession->hUSB; in SendToHdcStream()
186 return CheckPacketOption(hSession, appendData, dataSize); in SendToHdcStream()
192 PreSendUsbSoftReset(hSession, 0); // 0 == reset current in SendToHdcStream()