Lines Matching refs:hSession

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