Exemple #1
0
main2()
{
	idata int i;
	InitGraphic();//putchar(0,62,0);
	//while(1)
	for(i=0;i<100;i++)
	{
		putstring(6,0, "Welcome to http://shop34480016.taobao.com  www.dianshijin.cn");
	}
}
int cDriverSED1520::Init()
{
	int x;
	int i;
	struct timeval tv1, tv2;

	if (!(config->width % 8) == 0) {
		width = config->width + (8 - (config->width % 8));
	} else {
		width = config->width;
	}

	if (!(config->height % 8) == 0) {
		height = config->height + (8 - (config->height % 8));
	} else {
		height = config->height;
	}

	if (width < 0)
		width = 120;
	if (height < 0)
		height = 32;

	SEAD = kSEAD;
	SEPA = kSEPA;
	SEDS = kSEDS;
	DION = kDION;
	DIOF = kDIOF;
	LED  = kLEDHI;
	CDHI = kCDHI;
	CDLO = kCDLO;
	CS1HI = kCS1HI;
	CS1LO = kCS1LO;
	CS2HI = kCS2HI;
	CS2LO = kCS2LO;

	for (unsigned int i = 0; i < config->options.size(); i++)
	{
		if (config->options[i].name == "")
		{
		}
	}

	// setup linear lcd array
	LCD = new unsigned char *[(width + 7) / 8];
	if (LCD)
	{
		for (x = 0; x < (width + 7) / 8; x++)
		{
			LCD[x] = new unsigned char[height];
			memset(LCD[x], 0, height);
		}
	}
	// setup the lcd array for the paged sed1520
	LCD_page = new unsigned char *[width];
	if (LCD_page)
	{
		for (x = 0; x < width; x++)
		{
			LCD_page[x] = new unsigned char[(height + 7) / 8];
			memset(LCD_page[x], 0, (height + 7) / 8);
		}
	}

	if (config->device == "")
	{
		// use DirectIO
		if (port->Open(config->port) != 0)
			return -1;
		uSleep(10);
	}
	else
	{
		// use ppdev
		if (port->Open(config->device.c_str()) != 0)
			return -1;
	}

	if (nSleepInit() != 0)
	{
		syslog(LOG_DEBUG, "%s: INFO: cannot change wait parameters (cDriver::Init)\n", config->name.c_str());
		useSleepInit = false;
	}
	else
	{
		useSleepInit = true;
	}

	syslog(LOG_DEBUG, "%s: benchmark started.\n", config->name.c_str());
	gettimeofday(&tv1, 0);
	for (i = 0; i < 1000; i++)
	{
		port->WriteData(i % 0x100);
	}
	gettimeofday(&tv2, 0);
	if (useSleepInit)
		nSleepDeInit();
	timeForPortCmdInNs = (tv2.tv_sec - tv1.tv_sec) * 1000000 + (tv2.tv_usec - tv1.tv_usec);
	syslog(LOG_DEBUG, "%s: benchmark stopped. Time for Command: %ldns\n", config->name.c_str(), timeForPortCmdInNs);

	// initialize graphic mode
	InitGraphic();

	port->Release();

	*oldConfig = *config;

	// clear display
	Clear();

	syslog(LOG_INFO, "%s: SED1520 initialized.\n", config->name.c_str());
	return 0;
}
void CGraphicView::OnBnClickedImgcnfigbutton()
{
    switch (m_ImgConfigBtn.m_nMenuResult)
    {
    case ID_IMGCONFIG_DELETE:
    {

        if(m_nSerialNumber<=0)
        {
            AfxMessageBox(_T("Unavailable a Tstat!"));
            return;
        }
        WIN32_FIND_DATA fData;
        HANDLE hFile=NULL;
        hFile = FindFirstFile(m_strImgPathName,&fData);
        if(hFile != INVALID_HANDLE_VALUE)
        {
            CFile::Remove(m_strImgPathName);
        }
        FindClose(hFile);

// 			_ConnectionPtr tmpCon;
// 			_RecordsetPtr tmppRs;
// 			tmpCon.CreateInstance(_T("ADODB.Connection"));
// 			tmppRs.CreateInstance(_T("ADODB.Recordset"));
// 			tmpCon->Open(g_strDatabasefilepath.GetString(),_T(""),_T(""),adModeUnknown);
        CBADO bado;
        bado.SetDBPath(g_strCurBuildingDatabasefilePath);
        bado.OnInitADOConn();

        try
        {


            CString strImgFileName;
            strImgFileName=_T("");
            CString strSql;
            strSql.Format(_T("update ALL_NODE set Background_imgID ='%s' where Serial_ID = '%d'"),strImgFileName,m_nSerialNumber);
            bado.m_pConnection->Execute(strSql.GetString(),NULL,adCmdText);
            bado.CloseConn();
            g_strImagePathName=strImgFileName;
            m_strImgPathName=g_strImgeFolder+g_strImagePathName;
            InitGraphic(m_nSerialNumber,m_nTstatID);
        }
        catch(_com_error *e)
        {
            AfxMessageBox(e->ErrorMessage());
        }

        Invalidate();
    }
    break;

    case ID_IMGCONFIG_AND:

    {
        if(bac_cm5_graphic == false)
        {
            if(m_nSerialNumber<=0)
            {
                AfxMessageBox(_T("Unavailable a Tstat!"));
                return;
            }
        }
        else
        {
            if((g_bac_instance<=0) || (g_mac<=0))
            {
                AfxMessageBox(_T("Unavailable CM5!"));
                return;
            }
        }
        CString strFilter = _T("bmp file|*.bmp|jpg file|*.jpg|png file|*.png|tif file|*.tif|all file|*.*||");
        CFileDialog dlg(true,_T("Open image file"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER,strFilter);
        if(IDOK==dlg.DoModal())
        {
            CString strImgFilePathName=dlg.GetPathName();
            CString strImgFileName=dlg.GetFileName();
            CString strDestFileName=g_strImgeFolder+strImgFileName;

            CopyFile(strImgFilePathName,strDestFileName,FALSE);

            CBADO bado;
            bado.SetDBPath(g_strCurBuildingDatabasefilePath);
            bado.OnInitADOConn();
            try
            {

                CString strSql;
                strSql.Format(_T("update ALL_NODE set Background_imgID ='%s' where Serial_ID = '%d'"),strImgFileName,m_nSerialNumber);
                bado.m_pConnection->Execute(strSql.GetString(),NULL,adCmdText);

                bado.CloseConn();
            }
            catch(_com_error *e)
            {
                AfxMessageBox(e->ErrorMessage());
            }
            g_strImagePathName=strImgFileName;
            m_strImgPathName=g_strImgeFolder+g_strImagePathName;
            InitGraphic(m_nSerialNumber,m_nTstatID);
            Invalidate();
        }
        break;
    }
    }
}
Exemple #4
0
/*-----------------------------------------------------------------------------------*/
int
main(void)
{
	idata u8_t i, arptimer;
	idata u16_t j;
//	idata int i;
	InitGraphic();//putchar(0,62,0);
	//while(1)
	for(i=0;i<100;i++)
	{
		putstring(6,0, "Welcome to http://shop34480016.taobao.com  www.dianshijin.cn");
	}

	init_uart();
	printu("starting......\r\n");
	/* Initialize the device driver. */ 
	//  rtl8019as_init();
	dev_init();
	uip_arp_init();
	/* Initialize the uIP TCP/IP stack. */
	uip_init();
	printu("11111111111111111111111\r\n");
	/* Initialize the HTTP server. */
//	httpd_init();
	tcp_server_init();
	
	arptimer = 0;
	printu("222222222222222222222222222\r\n");
  while(1) {
    /* Let the tapdev network device driver read an entire IP packet
       into the uip_buf. If it must wait for more than 0.5 seconds, it
       will return with the return value 0. If so, we know that it is
       time to call upon the uip_periodic(). Otherwise, the tapdev has
       received an IP packet that is to be processed by uIP. */
    uip_len = dev_poll();
	for(j=0;j<500;j++);
/*
	if(uip_len > 0)
	{
		printuf("--------------- uip_len = 0x%x", uip_len);
		printuf("%x ----------\r\n", uip_len);
		for(i=0;i<uip_len;i++)
		{
			printuf("%x ", uip_buf[i]);
			if((i+1)%16==0) printu("\r\n");			
		}
		printu("\r\n");			
	}
*/
    if(uip_len == 0) {
      for(i = 0; i < UIP_CONNS; i++) {
	uip_periodic(i);
	/* If the above function invocation resulted in data that
	   should be sent out on the network, the global variable
	   uip_len is set to a value > 0. */
	if(uip_len > 0) {
	  uip_arp_out();
	  dev_send();
	}
      }

#if UIP_UDP
      for(i = 0; i < UIP_UDP_CONNS; i++) {
	uip_udp_periodic(i);
	/* If the above function invocation resulted in data that
	   should be sent out on the network, the global variable
	   uip_len is set to a value > 0. */
	if(uip_len > 0) {
	  uip_arp_out();
	  dev_send();
	}
      }
#endif /* UIP_UDP */
      
      /* Call the ARP timer function every 10 seconds. */
      if(++arptimer == 20) {	
	uip_arp_timer();
	arptimer = 0;
      }
      
    } else {
      if(BUF->type == htons(UIP_ETHTYPE_IP)) {
	uip_arp_ipin();
	uip_input();
	/* If the above function invocation resulted in data that
	   should be sent out on the network, the global variable
	   uip_len is set to a value > 0. */
	if(uip_len > 0) {
	  uip_arp_out();
	  dev_send();
	}
      } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
	uip_arp_arpin();
	/* If the above function invocation resulted in data that
	   should be sent out on the network, the global variable
	   uip_len is set to a value > 0. */	
	if(uip_len > 0) {	
	  dev_send();
	}
      }
    }
    
  }
  return 0;
}