亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? receivedatagramv3.0.c

?? 這是一個進程通信和手機數據處理程序, 與以前發的手機界面一起構成一個簡單手機系統,是我們做的第一個版本,供大家一起學習
?? C
?? 第 1 頁 / 共 3 頁
字號:
#include "MySHM.h"#include "Wrapper.c"void WriteHzStr(int num);
void WriteHz(unsigned char,unsigned char,int,int);
void GetHzBit(unsigned char,unsigned char);MYSHM	*ptr;int  	tidCount=0;pthread_attr_t   attr;pthread_t	tid_Produce[MAXNTHREADS];
/*Definition for CN character convert
FILE *fp;
long int fpos;
char bitdata[32];
int gmode,gdrive=DETECT;*/
/* Check if the id of a thread is out of range */static void CheckTidCount( void ){	if( tidCount > MAXNTHREADS )		tidCount = 0;	else		tidCount++;}
void *Produce( void *arg ){		int dosignal;   		NEWDATA *newData=(NEWDATA *)arg;		int tid=pthread_self();	    	printf("thread child%d enter\n",tid); 		Pthread_mutex_lock(&newData->myshmPtr->curMesg_mutex);		newData->myshmPtr->currentMesg = newData->currentMesg;printf("thread %d's type is %d,%d. \n",newData->myshmPtr->currentMesg,newData->currentMesg);		switch( newData->currentMesg )		{		case TYPE_OF_DWXX:						//Pthread_mutex_lock(&newData->myshmPtr->DWXX_mutex);			printf("$$$$$$Address of SHM to DWXX is %lX.$$$$$$$\n",newData->myshmPtr);			printf("-------Later Address DWXX of  newData  is %lX.-------\n",newData);			printf("-------Later Address DWXX of  newData->dwxx is %lX.-------\n",newData->dwxx);			newData->myshmPtr->dwxx = *(newData->dwxx);			/* Print the Value of each member of DWXX */			printf("Hour:%d,Minute:%d,QueryAddr:%X\n",newData->myshmPtr->dwxx.hour,newData->myshmPtr->dwxx.minute,newData->myshmPtr->dwxx.queryAddr);			//Pthread_mutex_unlock(&newData->myshmPtr->DWXX_mutex);				free( newData->dwxx );				break;		case TYPE_OF_TXXX:			//Pthread_mutex_lock(&newData->myshmPtr->TXXX_mutex);			printf("$$$$$$Address of SHM to DWXX is %lX.$$$$$$$\n",newData->myshmPtr);			printf("-------Later Address TXXX of  newData  is %lX.------\n",newData);			printf("-------Later Address TXXX of  newData->txxx is %lX.-------\n",newData->txxx);			newData->myshmPtr->txxx = *(newData->txxx);			/* Print the Value of each member of TXXX */			printf("SRCID is %X\n",(newData->myshmPtr->txxx).srcID);			//Pthread_mutex_unlock(&newData->myshmPtr->TXXX_mutex);				free( newData->txxx );			break;		case TYPE_OF_ICXX:					//Pthread_mutex_lock(&newData->myshmPtr->ICXX_mutex);			newData->myshmPtr->icxx = *(newData->icxx);			/* Print the Value of each member of ICXX */			//Pthread_mutex_unlock(&newData->myshmPtr->ICXX_mutex);			free( newData->icxx );				break;		case TYPE_OF_ZJXX:			//Pthread_mutex_lock(&newData->myshmPtr->ZJXX_mutex);			newData->myshmPtr->zjxx = *(newData->zjxx);			/* Print the Value of each member of ZJXX */			//Pthread_mutex_unlock(&newData->myshmPtr->ZJXX_mutex);				free( newData->zjxx );			break;		case TYPE_OF_SJXX:			//Pthread_mutex_lock(&newData->myshmPtr->SJXX_mutex);			newData->myshmPtr->sjxx = *(newData->sjxx);			/* Print the Value of each member of SJXX */			//Pthread_mutex_unlock(&newData->myshmPtr->SJXX_mutex);			free( newData->sjxx );				break;		case TYPE_OF_BBXX:			//Pthread_mutex_lock(&newData->myshmPtr->BBXX_mutex);			newData->myshmPtr->bbxx = *(newData->bbxx);			/* Print the Value of each member of BBXX */			//Pthread_mutex_unlock(&newData->myshmPtr->BBXX_mutex);			free( newData->bbxx );				break;		case TYPE_OF_FKXX:			//Pthread_mutex_lock(&newData->myshmPtr->FKXX_mutex);			newData->myshmPtr->fkxx = *(newData->fkxx);			/* Print the Value of each member of FKXX */			//Pthread_mutex_unlock(&newData->myshmPtr->FKXX_mutex);			free( newData->fkxx );				break;		}				Pthread_mutex_unlock(&(newData->myshmPtr->curMesg_mutex));		Pthread_mutex_lock(&newData->myshmPtr->nready_mutex);		dosignal = (newData->myshmPtr->nready == 0);		newData->myshmPtr->nready++;				Pthread_mutex_unlock(&newData->myshmPtr->nready_mutex);				if(dosignal)			Pthread_cond_signal(&newData->myshmPtr->cond);				sleep(2);		free( newData);		return(NULL);		}
/* We should wait to receive the  datagram in a
   daemon process or a single bankground thread
   all the time!
*/
void ReceiveDataGram( unsigned char recv )
{
	int 		i,j;	static int  	count=0;
	static unsigned char *DataGram,CMD[7],checkSum=0;
	static long 	DESID, DataLen;	static NEWDATA 	*newData;	static unsigned 	firstByte =0,secondByte=0,thirdByte=0,mid=256;		if( recv == '$')
	{
		if( count == 0)
		{   /*Begin to caculate checksum and recvieve data.*/
			checkSum ^= recv;
			CMD[count++]= recv;
		}
		else /*Reset the setting to avoid to receive the incorrect datagram*/
		{
			checkSum=0;
			count=0;
			return;
		}
	}
	else
	{
		if( count == DataLen-1 )
		{
			printf("Actual checksum value is : %X\n",checkSum);
		}
		checkSum ^= recv;

		if( count<= 6)
		{
			CMD[count]= recv;
			if( count == 6)
			{
				/* Getting to know the total length of */
				/* datagram in the 6th,7th byte,then   */
				/* we shall allocate the buffer area!  */
				firstByte=  CMD[count-1];
				secondByte= CMD[count ];
				DataLen= (long)firstByte*mid+secondByte;				printf("DataLen is %ld\n",DataLen);
				if ((DataGram= (unsigned char *)malloc(sizeof(unsigned char) *DataLen) ) == NULL)
				{
					printf("Not enough memory to allocate buffer\n");
					exit(1);  /* terminate program if out of memory */
				}
				memcpy(DataGram,CMD,7);
			}
			count++;
		}
		else if( count>6 && count<DataLen-1)
		{
			DataGram[count++]= recv;
		}
		else if( count == DataLen-1 )
		{
			if( checkSum == 0)
			{
				/* If checksum equals to zero at this time,it */
				/* means the checking for datagram is correct.*/
				/* We shall get the available message from it.*/
				printf("Code is %c \n",DataGram[1]);

				switch( DataGram[1] )
				{
				case 'D':					newData = (NEWDATA *)malloc(sizeof( NEWDATA ));					newData->dwxx = (DWXX *)malloc(sizeof( DWXX ));					
					/* Handle the information of location*/

					/* Obtain the id of the source user. */					
					firstByte=  DataGram[7];
					secondByte= DataGram[8];
					thirdByte=  DataGram[9];
					newData->dwxx->srcID= (long) firstByte*mid*mid + secondByte*mid + thirdByte;

					printf("SRCID is =%lX\n",newData->dwxx->srcID);


					/**Obtain the details of the message's type from the 10th byte**/

					/* This  bit state for the message type is location or query. */
					if(  ( newData->dwxx->locatType = DataGram[10] & 0x20) == 0)
						printf("Location.\n ");
					else
						printf("Inquery. \n ");

					/* This bit state for secret key encryption*/
					if(  ( newData->dwxx->isSecretKey = DataGram[10] & 0x10) == 0)
						printf("Never been encrypted.\n ");
					else
						printf("Have been encrypted. \n ");

					/* This bit state for the precision.*/
					/* First class states for 20 meters. */
					/* Second class states for 100 meters*/
					if(  ( newData->dwxx->precision = DataGram[10] & 0x08) == 0)
						printf("First class.\n ");
					else
						printf("Second class.\n ");

					/* This bit state for emergency location*/
					if(  ( newData->dwxx->isEmergenLoc = DataGram[10] & 0x04) == 0)
					{
						printf("Not choosed.\n ");
					}
					else
					{
						printf("Have been choosed.\n ");
					}

					/* This bit state for mutiple_answer.*/
					if(  ( newData->dwxx->mutipleKey = DataGram[10] & 0x02) == 0)
					{
						printf("Incorrect.\n ");
					}
					else
					{
						printf("Correct.\n ");
					}
					/* This bit state for type of height*/
					if(  ( newData->dwxx->heightType = DataGram[10] & 0x01) == 0)
					{
						printf("Normal.\n ");
					}
					else
					{
						printf("Height.\n ");
					}

					/**Obtain the Query ID from the message**/
					if( ( newData->dwxx->locatType == 0x00) && (DataGram[11] == DataGram[12] == DataGram[13] == 0x00) )
					{
						newData->dwxx->queryAddr= 0;
					}
					else if( newData->dwxx->locatType == 0x01)
					{
						firstByte=  DataGram[11];
						secondByte= DataGram[12];
						thirdByte=  DataGram[13];
						newData->dwxx->queryAddr= (long) firstByte*mid*mid + secondByte*mid + thirdByte;

						printf("QueryAddr is =%lX\n",newData->dwxx->queryAddr);
					}
					else
					{
						printf("Datagram has breached the BD protocol!");
					}

					/**Obtain the detail data of location from the message**/

					/* Obtain the time information */
					newData->dwxx->hour=  DataGram[14];
					if( newData->dwxx->hour<0 || newData->dwxx->hour>24)
					{
						printf(" Incorrect Hour!");
						exit( 0 );
					}
					else
						printf(" Received Hour is:%d \n",newData->dwxx->hour);


					newData->dwxx->minute= DataGram[15];
					if( newData->dwxx->minute<0 || newData->dwxx->minute>60)
					{
						printf(" Incorrect Minute!");
						exit( 0 );
					}
					else
						printf(" Received Minute is:%d \n",newData->dwxx->minute);

					newData->dwxx->second= DataGram[16];
					if( newData->dwxx->second<0 || newData->dwxx->second>60)
					{
						printf(" Incorrect Minute!");
						exit( 0 );
					}
					else
						printf(" Received second is:%d \n",newData->dwxx->second);


					newData->dwxx->perSecond= DataGram[17] * 0.01;
					if( newData->dwxx->perSecond<0 )
					{
						printf(" Incorrect Persecond!");
						exit( 0 );
					}
					else
						printf(" Received Persecond is:%f \n",newData->dwxx->perSecond);

					/* Obtain the longitude data */
					newData->dwxx->longitude.du = DataGram[18];
					if( newData->dwxx->longitude.du <0 || newData->dwxx->longitude.du >360)
					{
						printf(" Incorrect L_Degree!");
						exit( 0 );
					}
					else
						printf(" Received L_Degree is:%d \n",newData->dwxx->longitude.du);

					newData->dwxx->longitude.fen = DataGram[19];
					if( newData->dwxx->longitude.fen <0 || newData->dwxx->longitude.fen >60)
					{
						printf(" Incorrect L_AngleMin!");
						exit( 0 );
					}
					else
						printf(" Received L_AngleMin is:%d \n",newData->dwxx->longitude.fen);

					newData->dwxx->longitude.miao = DataGram[20];
					if( newData->dwxx->longitude.miao <0 || newData->dwxx->longitude.miao >60)
					{
						printf(" Incorrect L_AngleSec!");
						exit( 0 );
					}
					else
						printf(" Received L_AngleSec is:%d \n",newData->dwxx->longitude.miao);


					newData->dwxx->longitude.pMiao = DataGram[21] * 0.1;
					if( newData->dwxx->longitude.pMiao<0 )
					{
						printf(" Incorrect L_TenthAnglesec!");
						exit( 0 );
					}
					else
						printf(" Received L_TenthAnglesec is:%f \n",newData->dwxx->longitude.pMiao);


					/* Obtain the latitude data */
					newData->dwxx->latitude.du = DataGram[22];
					if( newData->dwxx->latitude.du<0 || newData->dwxx->latitude.du>360)
					{
						printf(" Incorrect B_Degree!");
						exit( 0 );
					}
					else
						printf(" Received B_Degree is:%d \n",newData->dwxx->latitude.du);

					newData->dwxx->latitude.fen = DataGram[23];
					if( newData->dwxx->latitude.fen<0 || newData->dwxx->latitude.fen>60)
					{
						printf(" Incorrect B_AngleMin!");
						exit( 0 );
					}
					else
						printf(" Received B_AngleMin is:%d \n",newData->dwxx->latitude.fen);

					newData->dwxx->latitude.miao = DataGram[24];
					if( newData->dwxx->latitude.miao<0 || newData->dwxx->latitude.miao>60)
					{
						printf(" Incorrect B_AngleSec!");
						exit( 0 );
					}
					else
						printf(" Received B_AngleSec is:%d \n",newData->dwxx->latitude.miao);

						 
					newData->dwxx->latitude.pMiao = DataGram[25] * 0.1;
					if( newData->dwxx->latitude.pMiao < 0 )
					{
						printf(" Incorrect B_TenthAnglesec!");
						exit( 0 );
					}
					else
						printf(" Received B_TenthAnglesec is:%f \n",newData->dwxx->latitude.pMiao);
					
					/**Obtain the height of target place**/
					if( newData->dwxx->heightType == 0 )
					{
						newData->dwxx->normalSign = DataGram[26] & 0xC0;
						newData->dwxx->height = (long)(DataGram[26] & 0x3F)*mid + DataGram[27];
						newData->dwxx->abnormalSign = DataGram[28];
						newData->dwxx->abnormalHeigtht = DataGram[29];
					}
					else
					{
						newData->dwxx->height = (long) DataGram[26]*mid*mid + DataGram[27]*mid + DataGram[28];
					}					/* write the data to the shared memory */										CheckTidCount( );

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久二区二区| 老司机精品视频在线| 蜜桃传媒麻豆第一区在线观看| 国内成人免费视频| 欧美精品自拍偷拍动漫精品| 国产欧美精品一区二区色综合 | 国产亚洲精品中文字幕| 亚洲国产精品久久艾草纯爱| 成人中文字幕合集| 日韩丝袜美女视频| 亚洲国产精品一区二区久久恐怖片| 国产精品自拍三区| 日韩精品最新网址| 日韩福利电影在线| 欧美日韩一区久久| 一区二区免费在线播放| av在线不卡电影| 国产性色一区二区| 国产一区二区三区最好精华液| 欧美美女bb生活片| 亚洲国产成人av好男人在线观看| 99热精品国产| 亚洲精品美腿丝袜| 成人短视频下载| 国产精品久久久久9999吃药| 成人黄色电影在线| 国产精品视频观看| 成人激情免费电影网址| 国产精品视频第一区| 99麻豆久久久国产精品免费| 亚洲欧洲无码一区二区三区| 91丨九色porny丨蝌蚪| 国产精品白丝在线| 色婷婷综合久久久中文字幕| 亚洲人成网站影音先锋播放| 一本大道久久a久久精二百| 亚洲视频一二三| 91丨九色丨蝌蚪丨老版| 亚洲综合清纯丝袜自拍| 欧美男人的天堂一二区| 日本vs亚洲vs韩国一区三区| 日韩欧美国产高清| 精品伊人久久久久7777人| 久久婷婷久久一区二区三区| 国产成人在线色| 亚洲乱码中文字幕综合| 欧美伊人精品成人久久综合97 | 欧美一区二区日韩一区二区| 日本不卡视频在线| 国产亚洲综合av| thepron国产精品| 午夜久久久久久久久久一区二区| 91精品国产综合久久久久久| 国内精品久久久久影院色| 中文字幕在线视频一区| 欧美亚洲尤物久久| 精品一区二区三区欧美| 日韩久久一区二区| 欧美一级黄色大片| 不卡的看片网站| 日韩中文字幕麻豆| 国产无遮挡一区二区三区毛片日本| 成人国产精品免费观看视频| 一区二区高清免费观看影视大全| 91精品国产91久久久久久最新毛片 | 久久久亚洲精品石原莉奈| 国产精品1区2区| 亚洲综合激情另类小说区| 日韩欧美亚洲国产精品字幕久久久| 成人午夜免费av| 免费成人在线播放| 亚洲精品日日夜夜| 精品国产乱码久久| 91浏览器打开| 国产一区福利在线| 偷窥少妇高潮呻吟av久久免费| 日韩欧美在线网站| 色久优优欧美色久优优| 国产剧情一区二区| 日韩av中文字幕一区二区 | 成人综合激情网| 日韩福利电影在线观看| 亚洲天堂福利av| 国产日产精品一区| 日韩欧美电影在线| 欧美日韩一区三区| 91蜜桃婷婷狠狠久久综合9色| 韩国午夜理伦三级不卡影院| 亚洲一区二区中文在线| 综合久久给合久久狠狠狠97色| 亚洲精品一区二区三区精华液| 欧美在线看片a免费观看| 粉嫩在线一区二区三区视频| 日本中文字幕一区二区视频| 亚洲一区二区视频在线观看| 国产精品日韩精品欧美在线| 亚洲精品在线观看网站| 在线播放一区二区三区| 欧美性生活一区| 色综合久久久久综合99| 成人av在线影院| 国产精品一区二区三区网站| 视频一区二区中文字幕| 一级特黄大欧美久久久| 成人免费视频在线观看| 国产精品色在线观看| 日韩三级电影网址| 宅男在线国产精品| 欧美人与性动xxxx| 91麻豆精品久久久久蜜臀| 欧美日韩精品一区二区三区四区| 一本大道久久a久久精品综合| 99re热视频这里只精品| 色综合久久久久久久久久久| 色综合久久中文字幕| 色婷婷综合视频在线观看| 日本电影欧美片| 欧洲精品视频在线观看| 欧美日韩一区成人| 欧美一级久久久| 精品国免费一区二区三区| 久久久久久久久久美女| 亚洲国产精品成人综合| 国产精品私房写真福利视频| 国产精品久久福利| 伊人婷婷欧美激情| 婷婷综合另类小说色区| 看电影不卡的网站| 国产伦精品一区二区三区免费 | 国产精品欧美一级免费| 国产精品久久久久天堂| 一区二区在线观看av| 亚洲国产日韩精品| 看国产成人h片视频| 国产99久久久国产精品免费看| aaa欧美色吧激情视频| 91蜜桃免费观看视频| 欧美欧美欧美欧美| 国产视频不卡一区| 亚洲欧美一区二区三区极速播放| 亚洲aaa精品| 精品一区二区三区在线播放| av男人天堂一区| 欧美日韩国产免费| 亚洲精品一区二区三区精华液| 中文字幕在线不卡一区| 午夜欧美大尺度福利影院在线看| 国产在线精品一区二区夜色| 99精品1区2区| 这里只有精品电影| 国产精品国产成人国产三级 | 欧美一区二区精品久久911| 久久蜜桃一区二区| 亚洲国产一区二区在线播放| 久久99精品久久只有精品| 91毛片在线观看| 精品处破学生在线二十三| 一区二区在线观看视频| 韩国成人福利片在线播放| 91福利在线观看| 国产天堂亚洲国产碰碰| 亚洲电影第三页| 成人免费观看av| 日韩精品一区二区三区三区免费 | 美女免费视频一区| 99精品欧美一区二区三区小说| 日韩亚洲欧美成人一区| 亚洲精品欧美在线| 国产河南妇女毛片精品久久久| 欧美日韩三级视频| 亚洲欧美一区二区久久| 国产精品77777| 欧美一区二区美女| 亚洲一区二区av在线| 不卡的av电影| 久久色成人在线| 免费高清在线一区| 欧美日韩国产成人在线91| 国产精品久久久久久久岛一牛影视 | 成人精品gif动图一区| 日韩一二三区不卡| 香蕉成人啪国产精品视频综合网| 成a人片国产精品| 国产日韩欧美麻豆| 国产中文字幕一区| 欧美国产激情二区三区 | 亚洲成人综合视频| 99久久免费精品高清特色大片| 久久精品视频在线免费观看| 蜜乳av一区二区| 日韩欧美一级精品久久| 麻豆精品视频在线观看| 欧美欧美欧美欧美| 日韩精品成人一区二区三区| 欧美日韩大陆在线| 视频一区视频二区中文字幕| 欧美丰满少妇xxxxx高潮对白| 亚洲成人精品在线观看| 欧美三级三级三级爽爽爽| 亚洲与欧洲av电影|