📄 iap_p.c
字号:
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* IAP_S.c
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* This file contains query part of IAP
*
* Author:
* -------
* -------
*
*****************************************************************************/
#include "kal_release.h" /* Basic data type */
#include "stack_common.h"
#include "stack_msgs.h"
#include "app_ltlcom.h" /* Task message communiction */
#include "stack_timer.h" /* Stack timer */
#include "irda_enums.h" /* irda enum */
#include "gprs_flc_kal.h"
#include "gprs_flc_common_data_types.h"
#include "flc_tunable_para.h"
#include "irconfig.h" /* IrPro system configuration */
#include "lap.h" /* LAP source header file */
#include "lmp.h" /* LMP source header file */
#include "iap_p.h" /* IAP primary stack header file */
#include "iap_s.h" /* IAP secondary stack header file */
#include "iastab.h" /* IAS table configuraton header file */
#include "support.h" /* system support functions */
#include "externs.h" /* system external definitions */
#include "stack_config.h"
#include "kal_trace.h"
#include "irda_trace.h"
kal_uint8 cfsm_state; /* client finite state machine var */
kal_uint8 scsm_state; /* s-call finite state machine var */
/*************************************************************************
* FUNCTION
* Init_IAS_p
*
* DESCRIPTION
* Initialize the primary ias protocol
*
* PARAMETERS
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
void Init_IAS_p ( void )/* init iap states*/
{
#if 0 /*we should not dump trace in init function*/
#ifdef IRDA_KAL_TRACE
/* under construction !*/
#endif
#endif
cfsm_state = S_DISCONNECT;
scsm_state = S_ASLEEP;
}
/*************************************************************************
* FUNCTION
* Format_GetValueByClass_Packet
*
* DESCRIPTION
* Initialize the primary ias protocol
*
* PARAMETERS
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
FBUF *Format_GetValueByClass_Packet(kal_uint8 class_name_index,
kal_uint8 attribute_name_index)
{
kal_uint8 *tmpbuf2;
FBUF *tmpptr;
kal_int16 offset1,offset2;
kal_uint8 *class_name;
kal_uint8 *attribute_name;
#ifdef IRDA_KAL_TRACE
kal_trace(TRACE_FUNC, IRDA_MSG48);
#endif
if ((tmpptr=Getbuf())==0)
{
ASSERT(0);
}
class_name=ias_class_name[class_name_index];
attribute_name=ias_attribute_name[attribute_name_index];
tmpptr->type=IAS_P_TYPE;
tmpbuf2=(kal_uint8*)tmpptr+I_TX_PACKET_OFFSET;
/* format the iap message */
tmpbuf2[2]=LST&NACK|GETVALUEBYCLASS_OP; /* the ctl field (byte 0) of IAP message */
tmpbuf2[3]=offset1=xstrlen((kal_char*)class_name);/* class name length*/
xmemcpy ((kal_uint8*)&tmpbuf2[4],(kal_uint8*)class_name,offset1);
/* attribute name */
tmpbuf2[4+offset1]=offset2=xstrlen((kal_char*)attribute_name);
xmemcpy ((kal_uint8*)&tmpbuf2[5+offset1],(kal_uint8*)attribute_name,offset2);
/*3:control, class name length, attribnte name length*/
tmpptr->size=3+offset1+offset2; /* add data size not including LM head*/
return(tmpptr);
}
/*************************************************************************
* FUNCTION
* Decode_GetValueByClass_Packet
*
* DESCRIPTION
* Initialize the primary ias protocol
*
* PARAMETERS
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint8 Decode_GetValueByClass_Packet( FBUF * frame, kal_uint8 *sel )
{
kal_uint8 * tmpptr;
kal_uint16 lleng;
kal_uint16 objid;
kal_uint32 lsap=0;
kal_uint32 tmplong;
kal_uint16 tmpint;
kal_uint8 type;
#ifdef IRDA_KAL_TRACE
kal_trace(TRACE_FUNC, IRDA_MSG49);
#endif
tmpptr=(kal_uint8*)frame+I_RX_OPCODE_OFFSET;
if((*tmpptr)!=0x84)/*the opcode of GetValueByClass*/
{
return(*(tmpptr+1));
}
/*list length*/
xmemcpy((kal_uint8*)&tmpint,(kal_uint8*)((kal_uint8*)tmpptr+2),2);
lleng=Swap_int_order(tmpint);
/*object id*/
xmemcpy((kal_uint8*)&tmpint,(kal_uint8*)((kal_uint8*)tmpptr+4),2);
objid=Swap_int_order(tmpint);
/*data type*/
type=*(tmpptr+6);
/*lsap_sel*/
xmemcpy((kal_uint8*)&tmplong,(kal_uint8*)((kal_uint8*)tmpptr+7),4);
lsap=Swap_long_order(tmplong);
*sel= (kal_uint8) lsap;
return(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -