示例#1
0
void Address::DetachedFromWindow()
{	
	SaveSettings();
	SaveBuffer();
	SaveAddresses();
	delete( m_pcIcon );	
}
示例#2
0
void CPlayerTaskSocket::OnReceive(int nErrorCode)
{
	ASSERT(g_PlayerMgr);

	char buffer[10240];
	int n=Receive(buffer, 10240);
	if(n == 0)
	{
		Close();
	}
	else if(n>0)
	{
		buffer[n] = 0;
		CStringA strHashId;
		int nRange = 0;
		if(ParseHttpReq(buffer, strHashId, nRange))
		{
			CSKey key;
			DWORD * pKey = (DWORD *)key.m_key;
			sscanf(strHashId, "%08x%08x%08x%08x", pKey, pKey+1, pKey+2, pKey+3);

			CSingleLock slock(&g_PlayerMgr->m_Mutex, true);

			CPlayerTask * pTask = g_PlayerMgr->GetPlayerTask(key);
			if(pTask)
			{
				TRACE("file size =%d\n", pTask->m_uTotalFileSize);
				//m_bRangeReq = true;
				ASSERT(m_nTotalBufferSize==0);
				pTask->AddSocket(this);
				//if(nRange > 222406523)
				//	nRange = 222406523;
				m_uCurrentPos = nRange;
				m_bSentData = true;
				if(nRange)
				{
					//if(m_uTailPos==0)
					{
						//m_uTailPos = m_uCurrentPos;
						//CStringA strHead = pTask->GetHeader(m_uTailPos);
						//SaveBuffer((void*)(const char*)strHead, strHead.GetLength());
					}
					//else
					{
					}
				}
				//else
				{
					CStringA strHead = pTask->GetHeader(nRange); 
					SaveBuffer((void*)(const char*)strHead, strHead.GetLength());
				}
			}

		}
	}

	CAsyncSocket::OnReceive(nErrorCode);
}
示例#3
0
uint8_t HIDUniversal::Poll() {
        uint8_t rcode = 0;

        if(!bPollEnable)
                return 0;

        if((long)(millis() - qNextPollTime) >= 0L) {
                qNextPollTime = millis() + pollInterval;

                uint8_t buf[constBuffLen];

                for(uint8_t i = 0; i < bNumIface; i++) {
                        uint8_t index = hidInterfaces[i].epIndex[epInterruptInIndex];
                        uint16_t read = (uint16_t)epInfo[index].maxPktSize;

                        ZeroMemory(constBuffLen, buf);

                        uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[index].epAddr, &read, buf);

                        if(rcode) {
                                if(rcode != hrNAK)
                                        USBTRACE3("(hiduniversal.h) Poll:", rcode, 0x81);
                                return rcode;
                        }

                        if(read > constBuffLen)
                                read = constBuffLen;

                        bool identical = BuffersIdentical(read, buf, prevBuf);

                        SaveBuffer(read, buf, prevBuf);

                        if(identical)
                                return 0;
#if 0
                        Notify(PSTR("\r\nBuf: "), 0x80);

                        for(uint8_t i = 0; i < read; i++) {
                                D_PrintHex<uint8_t > (buf[i], 0x80);
                                Notify(PSTR(" "), 0x80);
                        }

                        Notify(PSTR("\r\n"), 0x80);
#endif
                        ParseHIDData(this, bHasReportId, (uint8_t)read, buf);

                        HIDReportParser *prs = GetReportParser(((bHasReportId) ? *buf : 0));

                        if(prs)
                                prs->Parse(this, bHasReportId, (uint8_t)read, buf);
                }
        }
        return rcode;
}
示例#4
0
uint8_t HIDUniversal::Poll()
{
	uint8_t rcode = 0;

	if (!bPollEnable)
		return 0;

	if (qNextPollTime <= millis())
	{
		qNextPollTime = millis() + 50;

		uint8_t buf[constBuffLen];

		for (uint8_t i=0; i<bNumIface; i++)
		{
			uint8_t		index	= hidInterfaces[i].epIndex[epInterruptInIndex];
			uint16_t	read	= (uint16_t)epInfo[index].maxPktSize;

			ZeroMemory(constBuffLen, buf);

			uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[index].epAddr, &read, buf);

			if (rcode)
			{
				if (rcode != hrNAK)
					USBTRACE2("Poll:", rcode);
				return rcode;
			}

			if (read > constBuffLen)
				read = constBuffLen;

			bool identical = BuffersIdentical(read, buf, prevBuf);

			SaveBuffer(read, buf, prevBuf);

			if (identical)
				return 0;

			Serial.print("\r\nBuf: ");

			for (uint8_t i=0; i<read; i++)
				PrintHex<uint8_t>(buf[i]);

			Serial.println("");

			HIDReportParser		*prs = GetReportParser( ((bHasReportId) ? *buf : 0) );

			if (prs)
				prs->Parse(this, bHasReportId, (uint8_t)read, buf);
		}
	}
	return rcode;
}
示例#5
0
/* PutTargetFile: close and store waveform or parm file */
void PutTargetFile(char *s)
{
   if(tgtPK == WAVEFORM) {
      if(CloseWaveOutput(wv,tgtFF,s)<SUCCESS)
         HError(1014,"PutTargetFile: Could not save waveform file %s", s);
   }
   else {
      if(SaveBuffer(pb,s,tgtFF)<SUCCESS)
         HError(1014,"PutTargetFile: Could not save parm file %s", s );
      CloseBuffer(pb);
   }
   if (trace & T_TOP){
      AppendTrace("->"); AppendTrace(s);
      PrintTrace();     
      ResetHeap(&tStack);
      trList.str = NULL;
   }
   if(trans != NULL)
      SaveLabs(s,trans);
}
示例#6
0
文件: emu.c 项目: gillotte/gxgeo
static void take_screenshot(void) {
    /* Generate a BMP of the current buffer */
    char sbuffer[4096];
    sprintf(sbuffer, "fat:/screenie_%i.bmp",(int)time(NULL));
    SaveBuffer(sbuffer, &buffer);
}
示例#7
0
void Address::ClearBuffer()
{
	pcAddressDrop->Clear();
	m_cBuffer.clear();
	SaveBuffer();
}