⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dun_task.c

📁 蓝牙的spp dun ftp 功能的源代码
💻 C
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006
Part of BlueLab 3.6.2-release

FILE NAME
    main.c
    
DESCRIPTION
    Basic Example Application for the File Transfer Profile Client (FTPC) library
*/
#include "ObexServer.h"
#include "dun.h"
#include "spp.h"
#include <message.h>
#include <vm.h>
#include <stdio.h>
#include <panic.h>
#include <stdlib.h>  
#include <connection.h>
#include <source.h>
#include <string.h>
#include <ps.h>   


static void dun_handler ( Task task, MessageId id, Message message)
{
	 
	tDUNstate *state = (tDUNstate*)task;
	
	switch(id)
	{
			/* DUN Client Library Messages */
			case DUN_INIT_CFM:
			{
				DUN_INIT_CFM_T *msg = (DUN_INIT_CFM_T*)message;
				DUN_DEBUG(("DUN_INIT_CFM :- "));

				if (msg->status == dun_init_success )
				{
					DUN_DEBUG(("success\n"));
					/* Store the handle for this session so we can refer to it later */		                	                
					/* Start an DUN connection */
					state->dun=msg->dun;					

				}
				else
				{
					DUN_DEBUG(("failure : %d\n", msg->status));
				}


				break;
			}

	   

	  		case DUN_CONNECT_IND:
			{
				DUN_CONNECT_IND_T *msg = (DUN_CONNECT_IND_T*)message;
				DUN_DEBUG(("DUN_CONNECT_IND :- "));          
				state->dun=msg->dun;	
				DunConnectResponse  (  state->dun,    TRUE,   &( msg->addr) )  ;

				
				break;
			}

			
			case DUN_CONNECT_CFM:
			{
				DUN_CONNECT_CFM_T *msg = (DUN_CONNECT_CFM_T*)message;
				DUN_DEBUG(("DUN_CONNECT_CFM :- "));            
				DUN_DEBUG(("DUN_CONNECT_CFM status : %d\n", msg->status));
				
				if (msg->status == dun_connect_success)
				{
					DUN_DEBUG(("success \n"));					
				}
				else
				{
					DUN_DEBUG(("failure \n"));
				}
				break;
			}


			case DUN_DISCONNECT_IND:
			{
				DUN_DISCONNECT_IND_T  *msg = (DUN_DISCONNECT_IND_T *)message;
				DUN_DEBUG(("DUN_DISCONNECT  :- "));            
				DUN_DEBUG(("DUN_DISCONNECT  status : %d\n", msg->status));
				
				if (msg->status == dun_disconnect_success)
				{
					DUN_DEBUG(("success \n"));					
					DunDisconnect  (  state->dun )   ;
				}
				else
				{
					DUN_DEBUG(("failure \n"));
				}
				break;
			}
			
			case DUN_MESSAGE_MORE_DATA:
			{
			/*	DUN_MESSAGE_MORE_DATA_T   *msg = (DUN_MESSAGE_MORE_DATA_T  *)message;*/
				DUN_DEBUG(("DUN_MESSAGE_MORE_DATA \n"));            		
				
				break;
			}
			
			case DUN_MESSAGE_MORE_SPACE :
			{
				/*DUN_MESSAGE_MORE_SPACE_T    *msg = (DUN_MESSAGE_MORE_SPACE_T   *)message;*/
				DUN_DEBUG(("DUN_MESSAGE_MORE_SPACE  \n"));            		
				
				break;
			}

			  

			




			default:	
			{
				DUN_DEBUG(("Main Unhandled Message :  0x%0X\n",id)); 
				break;
			}	
		}
		
}


void  dun_initTask(tDUNstate*state)
{
	state->task.handler = dun_handler;
	
        
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -