• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PRTMSG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PRTMSG函数的典型用法代码示例。如果您正苦于以下问题:C++ PRTMSG函数的具体用法?C++ PRTMSG怎么用?C++ PRTMSG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PRTMSG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PRTMSG

bool CGpsSrc::_ReleaseGpsSrc()
{
	m_bGpsInit = false;
	if( false == _KillSirfReq() )
	{
		PRTMSG(MSG_NOR, "关闭SifvNav进程失败\n");
		g_bProgExit = true;
		return false;
	}
	else
	{
		PRTMSG(MSG_NOR, "关闭SifvNav进程成功\n");
	}

	sleep(1);

	if(-1 != m_iSemid)
	{
		semctl(m_iSemid,0,IPC_RMID);
		m_iSemid = -1;
	}

	if(-1 != m_iShmid)
	{
		//que 是否需要做失败的判断?
		shmctl(m_iShmid, IPC_RMID, NULL);
		m_iShmid = -1;
	}
	m_pShm = NULL;

	return true;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:32,代码来源:GpsSrc.cpp


示例2: PRTMSG

void CLN_Login::LoginAnswer(char *v_szBuf, DWORD v_dwLen)
{
	if( v_dwLen != 1 )
	{
		PRTMSG(MSG_ERR, "LoginAnswer len err, v_dwLen = %d\n", v_dwLen);
		return;
	}
	
	switch( v_szBuf[0] )
	{
	case 0x01:		// 登陆成功
		{
			PRTMSG(MSG_NOR, "Login succ!\n");
			g_objLNDownLoad.m_bNetFined = true;
			m_dwLoginTimers = 0;
			m_dwLoginSucc = 1;
			
			_KillTimer(&g_objTimerMng, LOGIN_TIMER);
			
			// 发送心跳维护帧
			HeartKeep();
		}
		break;
		
	case 0x00:		// 登陆失败,继续登陆
		{
			PRTMSG(MSG_NOR, "Login failed, continue Login!\n");
		}
		break;
		
	default:
		break;
	}
}
开发者ID:awzhang,项目名称:MyWork,代码行数:34,代码来源:LN_Login.cpp


示例3: PRTMSG

int CIO::IOCfgGet( unsigned char v_ucIOSymb, void *v_pIOCfg, DWORD v_dwCfgSize )
{
/*	_Init();*/

	if( v_ucIOSymb >= sizeof(SYSIO_CFG) / sizeof(SYSIO_CFG[0]) )
	{
		PRTMSG( MSG_ERR, "IOCfgGet %d: IOSymb Over Max Number\n", int(v_ucIOSymb) );
		return ERR_PAR;
	}

	if( v_pIOCfg && v_dwCfgSize >= sizeof(tagIOCfg) )
	{
		memcpy( v_pIOCfg, &SYSIO_CFG[v_ucIOSymb], sizeof(tagIOCfg) );
		PRTMSG( MSG_DBG, "IOCfgGet OK, No.%3d,Pin-%3d,prd-%4d,io-%d,brken-%d,brktyp-%d,brklvl-%d,low-%3d,hig-%3d\n", v_ucIOSymb,
			SYSIO_CFG[v_ucIOSymb].m_uiPinNo, SYSIO_CFG[v_ucIOSymb].m_uiContPrid, SYSIO_CFG[v_ucIOSymb].m_ucInOut,
			SYSIO_CFG[v_ucIOSymb].m_bBreak, SYSIO_CFG[v_ucIOSymb].m_cBreakType, SYSIO_CFG[v_ucIOSymb].m_cBreakPow,
			SYSIO_CFG[v_ucIOSymb].m_ucPinLowApp, SYSIO_CFG[v_ucIOSymb].m_ucPinHigApp );
		return 0;
	}
	else
	{
		PRTMSG( MSG_ERR, "IOCfgGet %d: output size(%d) lack!\n", int(v_ucIOSymb), int(v_dwCfgSize) );
		return ERR_PTR;
	}
}
开发者ID:awzhang,项目名称:MyWork,代码行数:25,代码来源:IO.cpp


示例4: memset

//设置RTC时间,使用GPS时间校对RTC(格林威治时间格式)
bool CGpsSrc::_SetTimeToRtc(struct tm* v_SetTime)
{
	struct rtc_time objRtcTime;

	memset(&objRtcTime, 0, sizeof(objRtcTime));

	int iDevRtc = open("/dev/misc/rtc", O_NONBLOCK);

	if(-1 == iDevRtc)
	{
		PRTMSG(MSG_ERR,"open rtc dev err\n");
		return false;
	}
		
	objRtcTime.tm_sec = v_SetTime->tm_sec;
	objRtcTime.tm_min = v_SetTime->tm_min;
	objRtcTime.tm_hour = v_SetTime->tm_hour;
	objRtcTime.tm_mday = v_SetTime->tm_mday;
	objRtcTime.tm_mon =	v_SetTime->tm_mon;
	objRtcTime.tm_year = v_SetTime->tm_year+1900;

	if(0 != ioctl(iDevRtc, RTC_SET_TIME, &objRtcTime))
	{
		close(iDevRtc);
		iDevRtc = -1;
		return false;
	}

	PRTMSG(MSG_DBG,"set gps time to rtc\n");

	close(iDevRtc);
	iDevRtc = -1;

	return true;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:36,代码来源:GpsSrc.cpp


示例5: ftok

//共享内存
int CGpsSrc::_ShmInit()
{
	int iShmid = -1;
	int i;
	key_t shmKey;
	int flag1, flag2;

	shmKey = ftok(KEYPATH,0);

	if (shmKey == -1)
	{
		PRTMSG(MSG_ERR,"failed to get a key from ftok(name, 0)\n");
		perror(" ");
		return -1;
	}
	for(i = 0; i<5; i++)
	{
		iShmid = shmget(shmKey,SHM_SIZE,0666 );
		if(-1 == iShmid)
		{
			PRTMSG(MSG_ERR,"shmget failed times: %d\n",i+1);
			sleep(1);
			continue;
		}
		else
		{
			return iShmid;
		}
	}

	PRTMSG(MSG_ERR,"gps shmget error\n");
	perror(" ");

	return -1;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:36,代码来源:GpsSrc.cpp


示例6: main

int main()
{
	//unsigned char ucIOSta = 0;
	int iVal = 0;
	tag2QServCodeCfg cfg;
	//tag1LComuCfg cfg2;
	int iCode = 1111111111;
	int iRet = 0;
	char buf[100] = { 0 };
	while(1)
	{
		memset( buf, 0, sizeof(buf) );
		sprintf( buf, "%d", iCode ++ );
		
		memcpy( cfg.m_szTaxHandtel, buf, sizeof(cfg.m_szTaxHandtel) );
		iRet = SetSecCfg( &cfg, offsetof(tagSecondCfg, m_uni2QServCodeCfg.m_obj2QServCodeCfg), sizeof(cfg) );
		PRTMSG( MSG_NOR, "Set seccfg: %s, result: %d\n", buf, iRet );

// 		memcpy( cfg2.m_szVeIDKey, buf, sizeof(cfg2.m_szVeIDKey) );
// 		iRet = SetImpCfg( &cfg2, offsetof(tagImportantCfg, m_uni1LComuCfg.m_obj1LComuCfg), sizeof(cfg2) );
// 		//iRet = SetImpCfg( buf, 200, sizeof(buf) );
// 		PRTMSG( MSG_NOR, "Set impcfg: %s, result: %d\n", buf, iRet );
		

		iVal ++;
		if( 20 == iVal ) break;

		usleep( 1000000 );
	}

	PRTMSG( MSG_NOR, "exit!\n" );
	exit( 0 );
}
开发者ID:awzhang,项目名称:MyWork,代码行数:33,代码来源:UseComuServ_CfgSet.cpp


示例7: PRTMSG

int COil::Init()
{
	// 打开串口
	if( !ComOpen() )
	{
		PRTMSG(MSG_ERR, "Open Com failed!\n");
		return ERR_COM;
	}

	pthread_mutex_init(&m_MutexAD, NULL);

	// 创建线程
	pthread_t pThreadRecv, pThreadSend;
	if( pthread_create(&pThreadRecv, NULL, G_ThreadOilRecv, NULL) != 0
		||
		pthread_create(&pThreadSend, NULL, G_ThreadOilSend, NULL) != 0
		)
	{
		PRTMSG(MSG_ERR, "Create thread failed!\n");
		perror("");
		return ERR_THREAD;
	}

	return 0;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:25,代码来源:yx_Oil.cpp


示例8: JBDemo_StartAudio

int JBDemo_StartAudio( void )
{
	int result;

	/* Initialize audio hardware and open an output stream. */
	Pa_Initialize();
	result = Pa_OpenDefaultStream( &audioStream,
	                               0, SAMPLES_PER_FRAME,
	                               paInt16,
	                               (double) SAMPLE_RATE,
	                               JukeBox_GetFramesPerTick(),
	                               0,
	                               JBDemo_Callback,
	                               NULL );
	if( result < 0 )
	{
		PRTMSG( "Pa_OpenDefaultStream returns " );
		PRTMSG( Pa_GetErrorText( result ) );
		PRTMSG( "\n" );

		goto error;
	}

	Pa_StartStream( audioStream );

error:
	return result;
}
开发者ID:gromgit,项目名称:hmsl,代码行数:28,代码来源:hmsl_midi_me2000.c


示例9: main

int main()
{
	unsigned char ucIOSta = 0;
	int iVal = 0;
	int iResult = 0;
	tag2QServCodeCfg cfg;
	tag1LComuCfg cfg2;
	char buf[100] = { 0 };
	//PRTMSG( MSG_NOR, "Run!\n" );
	while(1)
	{
		//PRTMSG( MSG_DBG, "Loop!\n" );

		memset( buf, 0, sizeof(buf) );

		//iResult = GetSecCfg( &cfg, sizeof(cfg), offsetof(tagSecondCfg, m_uni2QServCodeCfg.m_obj2QServCodeCfg), sizeof(cfg) );
		//memcpy( buf, cfg.m_szTaxHandtel, sizeof(cfg.m_szTaxHandtel) );
		
		iResult = GetImpCfg( &cfg2, sizeof(cfg2), offsetof(tagImportantCfg, m_uni1LComuCfg.m_obj1LComuCfg), sizeof(cfg2) );
		memcpy( buf, cfg2.m_szVeIDKey, sizeof(cfg2.m_szVeIDKey) );

		//iResult = GetImpCfg( buf, sizeof(buf), 200, sizeof(buf) );

		PRTMSG( MSG_NOR, "Get seccfg: %s, result: %d\n", buf, iResult );

		iVal ++;
		if( 50 == iVal ) break;

		usleep( 1000000 );
	}

	PRTMSG( MSG_NOR, "exit!\n" );
	exit( 0 );
}
开发者ID:awzhang,项目名称:MyWork,代码行数:34,代码来源:UseComuServ_CfgGet_2.cpp


示例10: PRTMSG

int CKTIrdMod::Init()
{
	// 打开红外口
	if( !ComOpen() )
	{
		PRTMSG(MSG_ERR, "Open Ird failed\n");
		return ERR_COM;
	}
	
	// 创建接收线程
	if( pthread_create(&m_pthreadRecv, NULL, G_ThreadIrdModKaiTianRecv, NULL) != 0 )
	{
		Release();
		PRTMSG(MSG_ERR, "Create Recv Thread failed\n");
		return ERR_THREAD;
	}

#if USE_IRD_KAITIAN == 1
	if( pthread_create(&m_pthreadWork, NULL, G_ThreadIrdModKaiTianWork, NULL) != 0 )
	{
		Release();
		PRTMSG(MSG_ERR, "Create Work Thread failed\n");
		return ERR_THREAD;
	}
#endif

	return 0;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:28,代码来源:yx_IrdModKaiTian.cpp


示例11: ExeUpdate

bool ExeUpdate()
{
	if( WaitForEvent(MOUNT, &g_objUsbSta.UDisk[0], 15000)==0 )
	{
		char const szUpdateFile[32] = "exe.bin";
		char diskPathUpfile[128] = {0};	//升级路径+升级文件
		
		sprintf(diskPathUpfile, "/mnt/%s/%s", UDISK_UP_PATH, szUpdateFile);
	
		// 将升级文件exe.bin复制到part3的下载目录下,以作为升级备份
		if( AppIntact(diskPathUpfile) == false || 0 != system("cp -f /mnt/UDisk/part1/exe.bin /mnt/Flash/part3/Down/exe.bin") )
		{
			PRTMSG(MSG_DBG, "cp exe.bin to part3 fail!\n");
			return false;
		}
		
#if VEHICLE_TYPE == VEHICLE_M
		if( G_ExeUpdate(diskPathUpfile, 1) == true )
#endif
#if VEHICLE_TYPE == VEHICLE_V8 || VEHICLE_TYPE == VEHICLE_M2
		if( G_ExeUpdate(diskPathUpfile, 0) == true )
#endif
		{
			PRTMSG(MSG_DBG, "soft update succ\n");
			
			DelErrLog();	// 升级成功后程序从分区5启动
		
			return true;
		}
	}
	
	return false;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:33,代码来源:yx_config.cpp


示例12: XUN_ASSERT_VALID

int CSock::DealSmsFrame( char* v_szBuf, int v_iBufLen, char* v_szVeTel, size_t v_sizTel)
{
    // 检查数据长度
    if( v_iBufLen < QIANDOWNFRAME_BASELEN )
    {
        XUN_ASSERT_VALID( false, "" );
        return ERR_PAR;
    }

    char* szDesTelInFrm = v_szBuf;
    char* szSrcTelInFrm = v_szBuf;
#if 0 == USE_PROTOCOL || 1 == USE_PROTOCOL || 30 == USE_PROTOCOL
    szDesTelInFrm = v_szBuf + 5;
    szSrcTelInFrm = v_szBuf + 20;
#endif
#if 2 == USE_PROTOCOL
    szDesTelInFrm = v_szBuf + 6;
    szSrcTelInFrm = v_szBuf + 21;
#endif

    BYTE bytTranType, bytDataType;
#if 0 == USE_PROTOCOL || 30 == USE_PROTOCOL
    bytTranType = BYTE( v_szBuf[3] );
    bytDataType = BYTE( v_szBuf[4] );
#endif
#if 1 == USE_PROTOCOL
    bytTranType = BYTE( v_szBuf[0] );
    bytDataType = BYTE( v_szBuf[1] );
#endif
#if 2 == USE_PROTOCOL
    bytTranType = BYTE( v_szBuf[4] );
    bytDataType = BYTE( v_szBuf[5] );
#endif

    // 检查请求帧的目的手机号
    if( 0x10 != bytTranType || 0x01 != bytDataType ) // 若不是设置短信中心号
    {
        if( v_szVeTel && v_szVeTel[0] && strncmp(szDesTelInFrm, v_szVeTel, v_sizTel) )
        {
            PRTMSG(MSG_DBG, "DesTel is uncorrect!\n");
            PRTMSG(MSG_DBG, "szDesTelInFrm is:%s\n", szDesTelInFrm);
            PRTMSG(MSG_DBG, "v_szVeTel is:%s\n", v_szVeTel);
            return ERR_PAR;
        }
    }

    // 检查校验和
    byte bytSum = get_crc_sms((byte*)v_szBuf, v_iBufLen - 1);
    if( bytSum != BYTE( v_szBuf[v_iBufLen - 1] ) )
    {
        PRTMSG(MSG_DBG, "get_crc_sms err!\n");
        return ERR_PAR;
    }

    // 转入具体事务处理
    AnalyzeSmsFrame( szSrcTelInFrm, szDesTelInFrm, bytTranType, bytDataType, v_szBuf + QIANDOWNFRAME_BASELEN - 1, v_iBufLen - QIANDOWNFRAME_BASELEN);

    return 0;
}
开发者ID:zyh329,项目名称:MyWork,代码行数:59,代码来源:yx_Sock.cpp


示例13: _KillTimer

void CSock::TcpLog()
{
    char buf[ 200 ] = { 0 };
    int iLen = 0;

    // TCP连续登陆失败次数达到上限
    if(m_iTcpLogTimers > TCP_MAX_LOG_TIMERS)
    {
        m_iTcpLogTimers = 0;
        _KillTimer(&g_objTimerMng, DVRTCP_LOG_TIMER);

        buf[0] = 0x01;	// 请求SockServExe重新连接套接字
        DataPush(buf, 1, DEV_DVR, DEV_SOCK, LV3);
        PRTMSG(MSG_NOR, "Tcp Log failed to max timers, request Tcp Reconnect!\n");

        // 调度屏进行提示
        G_TmShowMsg(NULL, 0);

        return;
    }

    m_bTcpLogged = false;

#if USE_LIAONING_SANQI == 1
    buf[0] = 0x07;
    buf[1] = m_bTcpLogged ? 0x01 : 0x00;
    DataPush(buf, 2, DEV_DVR, DEV_QIAN, LV3);
#endif
    _SetTimer(&g_objTimerMng, DVRTCP_LOG_TIMER, 15000, G_TmTcpLog );

#if 2 == USE_PROTOCOL
    tag1PComuCfg obj1PComuCfg;
    obj1PComuCfg.Init(CDMA_NAME,CDMA_PASS);
    GetImpCfg( &obj1PComuCfg, sizeof(obj1PComuCfg),	offsetof(tagImportantCfg, m_uni1PComuCfg.m_obj1PComuCfg), sizeof(obj1PComuCfg) );
    memcpy( m_objGPRS01.m_szUserIdenCode, USERIDENCODE, sizeof(m_objGPRS01.m_szUserIdenCode) );
#endif

    GetSelfTel( m_objGPRS01.m_szParData, sizeof(m_objGPRS01.m_szParData) );

#if 0 == USE_PROTOCOL || 1 == USE_PROTOCOL || 30 == USE_PROTOCOL
    const BYTE GPRSLOGFRM_TYPE = 0x11;
    const BYTE GPRSLOGFRM_GRADE = 0x10;
#endif
#if 2 == USE_PROTOCOL
    const BYTE GPRSLOGFRM_TYPE = 0x01;
    const BYTE GPRSLOGFRM_GRADE = 0x04;
#endif
    if( !_MakeTcpFrame( (char*)&m_objGPRS01, sizeof(m_objGPRS01), GPRSLOGFRM_TYPE, GPRSLOGFRM_GRADE, buf, sizeof(buf), iLen ) )
    {
        PRTMSG(MSG_NOR, "Send Tcp Log Frame\n" );

        G_RecordDebugInfo("Dvr Send Tcp Log Frame" );

        DataPush(buf, iLen, DEV_DVR, DEV_SOCK, LV3);
        m_iTcpLogTimers++;
    }
}
开发者ID:zyh329,项目名称:MyWork,代码行数:57,代码来源:yx_Sock.cpp


示例14: Deal_ReUpload

void Deal_ReUpload(void *arg, int len)
{
	if( g_szReUploadBuf[0] == 0xC1 )
		PRTMSG(MSG_DBG, "ReUpload C1 frame\n");
	if( g_szReUploadBuf[0] == 0xC3 )
		PRTMSG(MSG_DBG, "ReUpload C3 frame\n");

	//PrintString((char*)g_szReUploadBuf, g_iReUploadLen);

	DataPush(g_szReUploadBuf, (DWORD)g_iReUploadLen, DEV_DVR, DEV_SOCK, LV2);
}
开发者ID:awzhang,项目名称:MyWork,代码行数:11,代码来源:yx_black_new.cpp


示例15: PRTMSG

int CLightCtrl::Init()
{
	// ´´½¨¿ØÖƵÆÏß³Ì
	if( pthread_create(&m_pthreadLightCtrl, NULL, G_ThreadLightCtrl, NULL) != 0 )
	{
		PRTMSG(MSG_ERR, "create light thread failed!\n");
		return ERR_THREAD;
	}

	PRTMSG(MSG_ERR, "create light thread succ!\n");
	return 0;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:12,代码来源:LightCtrl.cpp


示例16: PRTMSG

bool CTcpSock::_JudgeConFailMaxTime(int &v_iFailTimes)
{
	if( DEV_QIAN == m_dwSymb || DEV_DVR == m_dwSymb)
	{
		if( v_iFailTimes >= 3 )	// 连续三次连接失败,则请求ComuExe重新拨号
		{
			v_iFailTimes = 0;
			
			if(m_dwSymb == DEV_DVR)
			{
				PRTMSG(MSG_ERR, "Dvr Tcp connect failed to max timers! Ask ComuExe to queck net!\n");
				G_RecordDebugInfo("Dvr Tcp connect failed to max timers! Ask ComuExe to queck net!");
			}
			if(m_dwSymb == DEV_QIAN)
			{
				PRTMSG(MSG_ERR, "Qian Tcp connect failed to max timers! Ask ComuExe to queck net!\n");
				G_RecordDebugInfo("Qian Tcp connect failed to max timers! Ask ComuExe to queck net!");
			}
			
			// 请求ComuExe重新拨号
			char buf[] = {0x34, 0x01};
			DataPush((void*)&buf, 2, DEV_SOCK, DEV_PHONE, LV3);
			
			buf[0] = 0x01;
			buf[1] = 0x03;
			if(DEV_QIAN == m_dwSymb)
			{
				// 同时请求QianExe向调度屏发送提示
				DataPush((void*)&buf, 2, DEV_SOCK, DEV_QIAN, LV3);
			}
			if(DEV_DVR == m_dwSymb)
			{
				// 同时请求DvrExe向调度屏发送提示
				DataPush((void*)&buf, 2, DEV_SOCK, DEV_DVR, LV3);
			}

			return true;
		}
		else
		{
			return false;
		}
	}
	else if( DEV_UPDATE == m_dwSymb )	// 升级服务器的TCP不去判断失败次数,一直重连
	{
		return false; // 暂不填充
	}
	
	return false;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:50,代码来源:TcpSock.cpp


示例17: open

bool CKTIrdMod::ComOpen()
{
	m_iComPort = open("/dev/misc/irdadrv", O_RDWR);
	if(m_iComPort == -1)
	{
		PRTMSG(MSG_ERR, "Ird Open failed\n");
		perror("");
		return false;
	}
	
	PRTMSG(MSG_DBG,"Ird Open Succ!\n"); 
	
	return true;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:14,代码来源:yx_IrdModKaiTian.cpp


示例18: shmget

int CDog::_ShmCreate()
{
	int iRet = 0;
	void* pShare = NULL;
	bool bFirstCreate = false;
	
	m_iShmID = shmget( (key_t)KEY_SHM_DOG, sizeof(DWORD), 0666 | IPC_CREAT | IPC_EXCL );
	if( -1 == m_iShmID )
	{
		m_iShmID = shmget( (key_t)KEY_SHM_DOG, sizeof(DWORD), 0666 | IPC_CREAT );
		if( -1 == m_iShmID )
		{
			iRet = ERR_SHMGET;
			PRTMSG( MSG_ERR, "shmget fail\n" ); 
			goto _SHM_CREATE_END;
		}
		else
		{
			PRTMSG( MSG_DBG, "shmget succ\n" ); 
		}
	}
	else
	{
		bFirstCreate = true;
	}
	
	pShare = shmat( m_iShmID, 0, 0 );
	if( (void*)-1 == pShare )
	{
		iRet = ERR_SHMAT;
		PRTMSG( MSG_ERR, "shmat fail\n" );
		goto _SHM_CREATE_END;
	}
	else
	{
		PRTMSG( MSG_DBG, "shmat succ\n" );
		m_pShareMem = (char*)pShare;
	}
	
	if( bFirstCreate )
	{
		_SemP();
		memset( m_pShareMem, 0xff, sizeof(DWORD) );
		_SemV();
	}
	
_SHM_CREATE_END:
	return iRet;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:49,代码来源:Dog.cpp


示例19: StopBlack

int StopBlack()
{
	if( g_objWorkStart.Black )
	{
		PRTMSG(MSG_NOR, "Stop Black\n");
		
		g_objWorkStop.Black = TRUE;
		/*pthread_join(g_pthreadBlack, NULL);*/
		
		PRTMSG(MSG_NOR, "stop black succ\n");
		return 0;
	}
	
	return -1;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:15,代码来源:yx_black_new.cpp


示例20: open

bool CComAdjust::ComOpen()
{
	int iResult;
	int i;
	struct termios options;
	const int COMOPEN_TRYMAXTIMES = 5;
	
	for( i = 0; i < COMOPEN_TRYMAXTIMES; i ++ )
	{
		m_iComPort = open("/dev/ttySIM0", O_RDWR );
		//m_iComPort = open("/dev/ttyAMA0", O_RDWR );

		if( -1 != m_iComPort )
		{
			PRTMSG(MSG_ERR,"Open com succ!\n");
			break;
		}
		
		sleep(1);
	}

	if( -1 == m_iComPort )
	{
		PRTMSG(MSG_ERR,"Open com fail!\n");
		return false;
	}
	
	if(tcgetattr(m_iComPort, &options) != 0)
	{
		perror("GetSerialAttr");
		return false;
	}
	
	options.c_iflag &= ~(IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IUCLC|IXON|IXOFF|IXANY); 
	options.c_lflag &= ~(ECHO|ECHONL|ISIG|IEXTEN|ICANON);
	options.c_oflag &= ~OPOST;
	
	cfsetispeed(&options,B9600);	//设置波特率,调度屏设置波特率为9600
	cfsetospeed(&options,B9600);
	
	if (tcsetattr(m_iComPort,TCSANOW,&options) != 0)   
	{ 
		perror("Set com Attr"); 
		return false;
	}
	
	return true;
}
开发者ID:awzhang,项目名称:MyWork,代码行数:48,代码来源:ComAdjust.cpp



注:本文中的PRTMSG函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PRUnichar函数代码示例发布时间:2022-05-30
下一篇:
C++ PROXY_IF_SANDBOXED函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap