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

📄 main.c.svn-base

📁 一款蓝牙芯片的驱动和应用代码
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
            {
                U08 idx;
                U16 *name;
                U08 type;
                idx = SelectFile();
                
                mpx_BtObexFtpCurrNodeMove(idx);
                mpx_BtObexFtpCurrNodeTypeGet(&type);                
                if(type == 0x00) //file
                {
                    mpx_BtObexFtpCurrNodeNameGet(&name);
                    if(!mpx_BtObexFtpGetFile(name, name))
                        MenuOpDisable();
                }
                
            }
                break;
            case FTP_PUTFILE:
            {
                if(!mpx_BtObexFtpPutFile("\0/\0t\0a\0l\0l\0p\0l\0a\0y\0.\0j\0p\0g\0"))
                    MenuOpDisable();
            }
                break;
        }

        currcmd = cmd;
    }
    else
    {
        U08 inttype;
        U08 intaction;
        U08 intcategory;

        inttype = BTINT_TYPE(buffer);
        intaction = BTINT_ACTION(buffer);
        intcategory = BTINT_CATEGORY(buffer);

        switch(intaction)
        {
            case REMOTE_DEVS:
            {
                U08 num;
                num = mpx_BtRemoteDevListNumGet(0);
                if(num)
                {
                    U08 idx;
                    idx = SelectTrustedDevice();
                    mpx_BtSelectDevsFromDevList(BRD_LIST_TRUSTED, idx);

                    if(idx >= num)
                        MenuItemEnable(FTP_CONNECT);
                }
                else //no device in list
                {
                    mpx_BtSelectDevsFromDevList(BRD_LIST_TRUSTED, 0xff);
                    MenuItemEnable(FTP_CONNECT);
                }
                break;
            }
            case GOEP_CONNECT:
                if(intcategory == P_FTPC && inttype == INFORM_COMPLETE)
                {
                    mpx_BtObexFtpUpdateFileList();
                }
                else if(intcategory == P_FTPC && inttype == INFORM_ABORT)
                {
                    //obex layer abort, so need to disconnect acl
                    mpx_BtObexFtpDisconnect();
                    //MenuItemEnable(FTP_CONNECT);
                }
                break;
            case LINK_CONNECT:
                if(intcategory == P_GENERAL && inttype == INFORM_COMPLETE)
                {
                    MenuItemDisable(FTP_CONNECT);
                    MenuItemEnable(FTP_DISCONNECT);
                }
                break;
            case LINK_DISCONNECT:
                if(intcategory == P_GENERAL && inttype == INFORM_COMPLETE)
                {
                    MenuItemDisable(FTP_DISCONNECT);
                    MenuItemEnable(FTP_CONNECT);
                }
                break;
            case GOEP_PULL:
                if(inttype == INFORM_COMPLETE)
                {                    
                    MenuItemEnable(FTP_DISCONNECT);
                    MenuItemEnable(FTP_SHOWDIR);
                }
                break;
            case GOEP_PUSH:
                if(inttype == INFORM_COMPLETE)
                {
                    if(!mpx_BtObexFtpUpdateFileList())
                    {
                        MenuItemDisable(FTP_DISCONNECT);
                        MenuItemDisable(FTP_SHOWDIR);
                    }
                }
                break;
            case GOEP_SETFOLDER:
                if(inttype == INFORM_COMPLETE)
                {
                    if(!mpx_BtObexFtpUpdateFileList())
                    {
                        MenuItemDisable(FTP_DISCONNECT);
                        MenuItemDisable(FTP_SHOWDIR);
                    }
                }
                else if(inttype == INFORM_ABORT)
                {
                    MenuItemDisable(FTP_DISCONNECT);
                    MenuItemEnable(FTP_SHOWDIR);
                }
                break;
            default:
                BtDefaultIntHandler(buffer);        
                break;
                
        }
 
    }
}

void DVsMenuHandler(U32 type, ...)
{
    #define ST_DEVICE_LIST      0
    #define ST_ADD_DEVICE       1
    #define ST_DEVICE_PAIRING   2
    U08 cmd;
    U08 *buffer;
    U08 nowcmd;
    static U08 state = ST_DEVICE_LIST;
    
    cmd = *(U32*)(((U08*)&type)+4);
    buffer = *(U32*)(((U08*)&type)+4);

    if(type == BTCMD)
    {
        switch(cmd)
        {
            case DVLST_EXIT:
                if(state == ST_DEVICE_LIST)
                {
                    pagemenu = &MainMenu;
                    pagemenu->refresh = TRUE;
                }
                else
                {
                    ShowTrustedDeviceList();
                    MenuItemEnable(DVLST_INQUIRY);
                    MenuItemDisable(DVLST_PAIR);
                    state = ST_DEVICE_LIST;
                }
                break;
            case DVLST_INQUIRY:
                mpx_BtStartInquiry();
                break;
            case DVLST_PAIR:
            {
                U08 index;
                state = ST_DEVICE_PAIRING;
                index = SelectSearchedDevice();
                mpx_BtRemoteDevPairing(index);
            }
                break;
            case DVLST_STOPINQUIRY:
                mpx_BtStopInquiry();
                MenuItemDisable(DVLST_STOPINQUIRY);         
                break;
            case DVLST_SDP:
            {
                mpx_BtRemoteDevDoSDP(0, SelectTrustedDevice());
            }
            break;
            case DVLST_DELDEVICE:
                mpx_BtRemoteDevDelete(SelectTrustedDevice());
                break;
        }
    }
    else
    {
        U08 inttype;
        U08 intaction;

        inttype = BTINT_TYPE(buffer);
        intaction = BTINT_ACTION(buffer);

        switch(intaction)
        {
            case REMOTE_DEVS_INQUIRY:
            {
                if(inttype == INFORM_START)
                {
                    MenuItemDisable(DVLST_INQUIRY);            
                    MenuItemEnable(DVLST_STOPINQUIRY);
                    state = ST_ADD_DEVICE;
                }
                else if(inttype == INFORM_COMPLETE)
                {
                    MenuItemDisable(DVLST_STOPINQUIRY);         
                    MenuItemEnable(DVLST_PAIR);
                }
                break;
            }
            case REMOTE_DEVS_LIST:
            {
                if(state == ST_ADD_DEVICE)
                {
                    if(inttype == INFORM_NUMBER_CHANGE)
                        ShowUnTrustedDeviceList();
                    else if(inttype == INFORM_CONTENT_CHANGE)
                        ShowUnTrustedDeviceList();
                }
                else if(state == ST_DEVICE_LIST)
                {
                    ShowTrustedDeviceList();
                }
                break;
            }
            default:
                BtDefaultIntHandler(buffer);
                break;
        }
    }

    #undef ST_DEVICE_LIST
    #undef ST_ADD_DEVICE
}
/***************************************************************************/
void A2DPsrcMenuHandler(U32 type, ...)
{
    U08 cmd;
    U08 *buffer;
    U08 addr[6];
	S32 retCode;
	
	//Kevin, temp
	#if 0//嘲睲
	addr[5] = 0x00;
	addr[4] = 0x0D;
	addr[3] = 0x3C;
	addr[2] = 0xA3;
	addr[1] = 0x21;
	addr[0] = 0x9B;
	#elif (1)//samsung
	addr[5] = 0x00;
	addr[4] = 0x08;
	addr[3] = 0xD6;
	addr[2] = 0x53;
	addr[1] = 0x13;
	addr[0] = 0x70;
	#elif (0)//jebra
	addr[5] = 0x00;
	addr[4] = 0x13;
	addr[3] = 0x17;
	addr[2] = 0x71;
	addr[1] = 0x7D;
	addr[0] = 0x3B;
	#else//imego
	addr[5] = 0x00;
	addr[4] = 0x14;
	addr[3] = 0x41;
	addr[2] = 0x00;
	addr[1] = 0x03;
	addr[0] = 0xa9;
	#endif
    cmd = *(U32*)(((U08*)&type)+4);
    buffer = *(U32*)(((U08*)&type)+4);
	
    if(type == BTCMD)
    {
        switch(cmd)
        {
            case A2DP_SRC_EXIT:
                DPrintf("Bluetooth Disable A2DP src ok!");
                pagemenu = &MainMenu;
                pagemenu->refresh = TRUE;
                break;
            case A2DP_SRC_OPEN:
                mpx_BtA2dpOpen(&addr);
				break;
            case A2DP_SRC_CONFIG:
                mpx_BtA2dpConfig();
				break;
			case A2DP_SRC_RECONFIG:
				break;
			case A2DP_SRC_SUSPEND:
				break;
			case A2DP_SRC_RESUME:
            	break;
        }
    }
    else
    {
        U08 inttype;
        U08 intaction;

        inttype = BTINT_TYPE(buffer);
        intaction = BTINT_ACTION(buffer);

		//DPrintf("Bluetooth A2DP src INT 0x%x", intaction);

        switch(intaction)
        {
            case REMOTE_DEVS:
                if(mpx_BtRemoteDevListNumGet(0))
                {
                    mpx_BtSelectDevsFromDevList(BRD_LIST_TRUSTED, SelectTrustedDevice());
                }
                else //no device in list
                    mpx_BtSelectDevsFromDevList(BRD_LIST_TRUSTED, 0xff);
            
                break;

            default:
                BtDefaultIntHandler(buffer);
                break;
        }
    }
}

/***************************************************************************/
void HandsetMenuHandler(U32 type, ...)
{
    U08 cmd;
    U08 *buffer;

    cmd = *(U32*)(((U08*)&type)+4);
    buffer = *(U32*)(((U08*)&type)+4);

    if(type == BTCMD)
    {
        switch(cmd)
        {
            case HANDSET_TALK:
                mpx_BtHsButton(0);
                break;
            case HANDSET_HSMVDOWN:
                mpx_BtHsButton(1);
                break;
            case HANDSET_HSMVUP:
				mpx_BtHsButton(2);
                break;
			case HANDSET_HSSVDOWN:
				mpx_BtHsButton(3);
				break;
			case HANDSET_HSSVUP:
				mpx_BtHsButton(4);
				break;
			case HANDSET_EXIT:
				break;
        }
    }
    else
    {
        U08 inttype;
        U08 intaction;

        inttype = BTINT_TYPE(buffer);
        intaction = BTINT_ACTION(buffer);

		DPrintf("Bluetooth Handset GW INT 0x%x", intaction);

        switch(intaction)
        {
            case REMOTE_DEVS:
                if(mpx_BtRemoteDevListNumGet(0))
                {
                    mpx_BtSelectDevsFromDevList(BRD_LIST_TRUSTED, SelectTrustedDevice());
                }
                else //no device in list
                    mpx_BtSelectDevsFromDevList(BRD_LIST_TRUSTED, 0xff);
            
                break;
				
            default:
                BtDefaultIntHandler(buffer);
                break;
        }
    }
}

/***************************************************************************/
void HSGWMenuHandler(U32 type, ...)
{
    U08 cmd;
    U08 *buffer;
    U08 addr[6];

	//Kevin, temp
	addr[5] = 0x00;
	addr[4] = 0x08;
	addr[3] = 0xD6;
	addr[2] = 0x53;
	addr[1] = 0x13;
	addr[0] = 0x70;
	
    cmd = *(U32*)(((U08*)&type)+4);
    buffer = *(U32*)(((U08*)&type)+4);

    if(type == BTCMD)
    {
        switch(cmd)
        {
            case HANDSET_GW_DISCONNECT:
                DPrintf("Bluetooth Disable Handset GW ok!");
				mpx_BtHsgwDisconnect(&addr);
                pagemenu = &MainMenu;
                pagemenu->refresh = TRUE;
                break;
            case HANDSET_GW_OUTGOING:
                mpx_BtHsgwOutgoing(&addr);
                break;
            case HANDSET_GW_INCOMING:
				mpx_BtHsgwIncoming(&addr);
                break;
			case HANDSET_GW_REGHANDSET:
				mpx_BtHsgwRegHS(&addr);
				break;
        }
    }
    else
    {
        U08 inttype;
        U08 intaction;

        inttype = BTINT_TYPE(buffer);
        intaction = BTINT_ACTION(buffer);

		DPrintf("Bluetooth Handset GW INT 0x%x", intaction);

        switch(intaction)
        {
            case REMOTE_DEVS:
                if(mpx_BtRemoteDevListNumGet(0))
                {
                    mpx_BtSelectDevsFromDevList(BRD_LIST_TRUSTED, SelectTrustedDevice());
                }
                else //no device in list
                    mpx_BtSelectDevsFromDevList(BRD_LIST_TRUSTED, 0xff);
            
                break;
				
            default:
                BtDefaultIntHandler(buffer);
                break;
        }
    }
}

/***************************************************************************/
void SPPMenuHandler(U32 type, ...)
{
    U08 cmd;
    U08 *buffer;

⌨️ 快捷键说明

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