当前位置:文档之家› 802.15.4协议栈的API接口函数手册

802.15.4协议栈的API接口函数手册

Jennic

TECHNOLOGY FOR A CHANGING WORLD

802.15.4 Stack API Reference Manual

JN-RM-2002

Revision 1.7

10-Jan-2007

Jennic

Disclaimer

The contents of this document are subject to change without notice. Customers are advised to consult with JENNIC commercial representatives before ordering.

The information and circuit diagrams in this document are presented as examples of semiconductor device applications, and are not intended for incorporation in devices for actual use. In addition, JENNIC is unable to assume responsibility for infringement of any patent rights or other rights of third parties arising from the use of this information or circuit diagrams.

No license is granted by its implication or otherwise under any patent or patent rights of JENNIC Ltd

“Typical” parameters, which are provided in this document, may vary in different applications and performance may vary over time. All operating parameters must be validated for each customer application by the customer’s own technical experts.

CAUTION:

Customers considering the use of our products in special applications where failure or abnormal operation may directly affect human lives or cause physical injury or property damage, or where extremely high levels of reliability are demanded (such as aerospace systems, atomic energy controls, vehicle operating controls, medical devices for life support, etc.) are requested to consult with JENNIC representatives before such use. JENNIC customers using or selling products incorporating JENNIC IP for use in such applications do so at their own risk and agree to fully indemnify JENNIC for any damages resulting from such improper use or sale.

2 ? Jennic 2007 JN-RM-2002 v1.7

Jennic

Contents

Disclaimer 2 Contents 3 About this Manual 5 Organisation 5 Conventions 5 Acronyms and Abbreviations 5 Revision History 6

1 Introduction 7

2 Service Access Point API 8 2.1 Background

information 8 2.1.1 Service Access Point fundamentals 8 2.1.2 Blocking and non-blocking operation 8 2.1.3 Call/callback

interface 9 2.2 Implementation 10

functions 11 2.3 API

Request/Response 11 2.3.1 Send

2.3.2 Register Deferred Confirm/Indication callbacks 11

3 MAC / Network layer interface 12 3.1 Network layer to MAC layer interface 12 3.1.1 NWK to MLME 13 3.1.2 NWK to MCPS 17 3.2 MAC layer to Network layer interface 20 3.2.1 MLME/MCPS to NWK 20

Settings 23

3.2.2 MAC

4 IEEE 802.15.4 MAC/PHY features 24

returns 24 4.1 Status

4.2 PAN Information Base 25 4.2.1 MAC Layer PIB access 25 4.2.2 Physical Layer PIB access 28

Reset 31 4.3 MAC

Example 31 4.3.1 Reset

4.4 Scan 32 4.4.1 Energy Detect Scan 32

Scan 32 4.4.2 Active

Scan 32 4.4.3 Passive

Scan 32 4.4.4 Orphan

Request 33 4.4.5 Scan

Confirm 33 4.4.6 Scan

Indication 36 4.4.7 Orphan

Response 37 4.4.8 Orphan

4.4.9 Comm Status Indication 37 4.4.10 Examples 39

JN-RM-2002 v1.7 ? Jennic 2007 3

Jennic

4.5 Start 41

request 41 4.5.1 Start

confirm 42 4.5.2 Start

4.5.3 Examples 43 4.6 Synchronisation 44 4.6.1 Sync

request 44 4.6.2 Sync loss indication 45 4.6.3 Beacon Notify Indication 46 4.6.4 Poll

Request 47

Confirm 47 4.6.5 Poll

4.6.6 Examples 48 4.7 Association 49

Request 50 4.7.1 Associate

Confirm 51 4.7.2 Associate

Indication 52 4.7.3 Associate

Response 52 4.7.4 Associate

4.7.5 Comm Status Indication 53 4.7.6 Examples 54 4.8 Disassociation 57

Request 57 4.8.1 Disassociate

4.8.2 Disassociate

Confirm 58

Indication 59 4.8.3 Disassociate

4.8.4 Examples 59 4.9 Data transmission and reception 60

Request 60 4.9.1 Data

Confirm 61 4.9.2 Data

Indication 62 4.9.3 Data

Request 63 4.9.4 Purge

Confirm 63 4.9.5 Purge

4.9.6 Examples 64 4.10 Rx Enable 66

Request 67 Enable

4.10.1 Rx

Confirm 67 Enable

4.10.2 Rx

4.10.3 Examples 68 4.11 Guaranteed Time Slots (GTS) 68

Request 69 4.11.1 GTS

Confirm 69 4.11.2 GTS

Indication 70 4.11.3 GTS

4.11.4 Examples 71 Appendix A 73 References 74

4 ? Jennic 2007 JN-RM-2002 v1.7

Jennic

About this Manual

This manual provides a detailed reference for the Jennic 802.15.4 Stack API (Application Programming Interface). This facilitates control of the 802.15.4 MAC hardware within the Jennic JN5121 and JN513x single-chip wireless microcontrollers. This software is supplied as a set of precompiled library builds with the Jennic Software Developer’s Kit (SDK).

Note: This manual was previously called the 802.15.4 MAC Software Reference Manual.

Organisation

This manual consists of four chapters and an appendix:

? Chapter 1 defines the scope of the manual.

? Chapter 2 describes the implementation of the API.

? Chapter 3 describes in detail the MAC-Network Layer Interface.

? Chapter 4 outlines the MAC/PHY features.

? Appendix A describes how to identify modules and devices.

Conventions

Code fragments, function prototypes or filenames are represented by Courier typeface. When referring to constants or functions defined in the code they are emboldened like so. Acronyms and Abbreviations

ACL Access Control List

AHI Application Hardware Interface

Programming

Interface

API Application

CAP Contention Access Period

FFD Full Function Device

GTS Guaranteed Time Slot

MAC Medium Access Control

MCPS MAC common Part Sublayer

MLME MAC sub-Layer Management Entity

(layer)

NWK Network

PAN Personal Area Network

PHY Physical

PIB PAN Information Base

RFD Reduced Function Device

SAP Service Access Point

JN-RM-2002 v1.7 ? Jennic 2007 5

Jennic

Revision History

Version Date Description

1.0 11-Sept-2005 First release

1.1 14-Nov-2005 Updated document style

1.2 27-Jan-2006 Aligned document with updated API 1.3 14-Mar-2006 Updated PIB access section 1.4 12-Apr-2006 Added Appendix A

1.5 06-Oct-2006 Name of API changed from 80

2.15.4 MAC Software to 802.15.4 Stack API 1.6 16-Oct-2006 Updated PHY PIB access description 1.7

10-Jan-2007

Updated for JN513x chip series

6 ? Jennic 200

7 JN-RM-2002 v1.7

Jennic

1 Introduction

This document describes the structure of the 802.15.4 Stack API to be used in conjunction with the Jennic JN5121 and JN513x single-chip wireless microcontrollers. The interface described is exposed at the level of transactions into and out of the stack; this allows different types of interfaces to be written which deal with buffering messages in ways best suited to the type of application that uses the stack. An example of this is found in the description of the Demonstration Application, which takes the API described here, and puts a queue-based interface on top for storing and dealing with information entering and leaving the stack.

Note: This API was previously known as the 802.15.4 MAC Software.

JN-RM-2002 v1.7 ? Jennic 2007 7

Jennic

2 Service Access Point API

2.1 Background information

This section gives some information on the background behind how the API has been implemented.

2.1.1 Service Access Point fundamentals

[2] specifies the service primitives, which pass between what is described as the “N-user” and the “N-layer”. “N” is simply an abstract term to describe a specific layer of the protocol stack under consideration.

This document considers the service primitives, which pass between the user of the 802.15.4 MAC User and the 802.15.4 MAC Layer as specified in [1].

In general, the service primitives are classified as follows:

? Request

? Confirm

? Indication

? Response

MAC User

A Request transaction is initiated by the MAC User and may solicit a Confirm. An Indication transaction is initiated by the MAC Layer and may solicit a Response.

As this is purely a reference model, a specific implementation needs to be built upon the reference model. This section describes the implementation based on the reference model.

2.1.2 Blocking and non-blocking operation

An implementation issue, which needs to be considered, is whether transactions are:

? Blocking (synchronous)

? Non-blocking (asynchronous).

8 ? Jennic 2007 JN-RM-2002 v1.7

Jennic

2.1.2.1

Blocking transaction

A blocking, or synchronous transaction occurs when the initiator of the transaction explicitly waits for information coming back from the target of the transaction.

In the case of a Request, the MAC User would wait for a Confirm before carrying on processing. In the case of an Indication, the MAC Layer would wait for a Response before carrying on processing.

Mac Layer thread of execution

Mac User thread of execution

Mac Layer thread of execution

Mac User thread of execution

2.1.2.2

Non-blocking transaction

A non-blocking transaction occurs when the initiator of the transaction does not explicitly wait for information to come back from the target of the transaction before continuing its own execution In the case of a Request, the Application would send the Request then carry on processing; the Confirm would come back some time later (i.e. asynchronously) and be processed accordingly. In the case of an Indication, the MAC Layer would send the Indication then carry on processing; the Response would come back asynchronously and be processed accordingly.

Mac Layer thread of execution

Mac User thread of execution

Mac Layer thread of execution

Mac User thread of execution

2.1.3 Call/callback interface

The most straightforward API is via a function call/callback interface.

A function call is made from the application to the library in the applications thread of execution. The function can be called directly by the application

A function callback is made from a library to the application in the library’s thread of execution. The callback function is registered with the library by the application, and is available for the library to call.

JN-RM-2002 v1.7 ? Jennic 2007 9

Jennic

Library

Application

Library

Application

Note that the two threads of execution do not necessarily have to be the same, but the key point is that the call/callback is executed in the thread of execution of the caller of the function.

2.2 Implementation

Based on the above, an implementation can be formed which satisfies all cases of blocking and non-blocking operations for the primitives based on a call/callback interface. This is illustrated as follows:

MAC Library

Application

MAC Library

Application

Indication/Response processing

10 ? Jennic 2007 JN-RM-2002 v1.7

Jennic The one restriction is that there is no synchronous response to an indication. This is not really a problem as:

? Most indications do not solicit a response as they represent an event

? Control of processing is governed by the higher layers and thus the response may need to be formed in a different thread of execution.

? The MAC layer is implemented as a finite state machine and is thus implicitly able to handle asynchronous transactions.

Conversely, it is useful to have a synchronous Confirm to many Requests, such as PIB Get and Set, which can be satisfied by a synchronous transaction; also, if a Request results in an error, this may often be returned straight away.

2.3 API functions

So, from the above diagram, the call/callback interface is implemented via two interface functions:

? Send Request/Response

? Register Deferred Confirm/Indication callbacks

2.3.1 Send Request/Response

The Request/Response functions are used by the Application to send a Request or a Response to the appropriate SAP.

2.3.2 Register Deferred Confirm/Indication callbacks

The callback registration function is used by the Application to register two Callbacks for Deferred Confirms and Indications. A two-phase callback system is used as it gives the Application control of the buffer allocation. This allows the Application to easily implement a basic queuing system for Deferred Confirms and Indications, which are always handled asynchronously.

The two callbacks are:

? Get Buffer

? Post

The GetBuffer callback is called by the MAC whenever it needs to get a buffer into which it will write the Deferred Confirmation or the Indication.

The Post callback is called by the MAC at the point it wishes to post the Deferred Confirm or Indication to the Application

JN-RM-2002 v1.7 ? Jennic 2007 11

Jennic

3 MAC / Network layer interface

This section describes the interface between the Network layer and the MAC layer. The figure provides an overview of the functions making up this interface.

The following sections first describe the functions allowing requests from the Network layer to the MAC layer and then the (callback) functions allowing the MAC layer to request the Network layer to allocate buffer space and to pass information back to the Network layer.

3.1 Network layer to MAC layer interface

The NWK to MLME and NWK to MCPS interfaces are implemented as calls from the NWK layer to routines provided by the MAC. The general procedure to use these calls is to fill in a structure representing a request to the MAC and either receive a synchronous confirm, for

which space must be allocated, or to expect a deferred (asynchronous) confirm at some time later. The application may elect to perform other tasks while waiting for a deferred confirm, or if there is nothing for it to do, go to sleep to save power.

12 ? Jennic 2007 JN-RM-2002 v1.7

Jennic

3.1.1 NWK to MLME

Declaration PUBLIC void

vAppApiMlmeRequest(MAC_MlmeReqRsp_s *psMlmeReqRsp,

MAC_MlmeSyncCfm_s *psMlmeSyncCfm);

Inputs MAC_MlmeReqRsp_s *psMlmeReqRsp Pointer to a structure holding the request to the

MLME interface

MAC_MlmeSyncCfm_s *psMlmeSyncCfm Pointer to a structure used to hold the result of a

synchronous confirm to a request over the MLME

interface

Outputs None

Description Routine used to pass MLME requests from the NWK layer or Application to the MAC.

The psMlmeReqRsp parameter is a pointer to a structure holding the request to the

MLME. The structure is of type MAC_MlmeReqRsp_s, defined below

/**

* MLME Request/Response

*

* The object passed to vAppApiMlmeRequest containing

* the request

*/

typedef struct

{

uint8 u8Type;

uint8 u8ParamLength;

uint16 u16Pad;

MAC_MlmeReqRspParam_u uParam;

} MAC_MlmeReqRsp_s;

The structure consists of 4 fields. The first, u8Type defines the type of request or

response that the structure carries; values carried in this field are defined in the

enumeration MAC_MlmeReqType_e shown below:

/* Enumeration of MAC MLME Request/Response

* Must not exceed 256 entries

*/

typedef enum

{

MAC_MLME_REQ_ASSOCIATE = 0,

MAC_MLME_REQ_DISASSOCIATE,

MAC_MLME_REQ_GET,

MAC_MLME_REQ_GTS,

MAC_MLME_REQ_RESET,

MAC_MLME_REQ_RX_ENABLE,

MAC_MLME_REQ_SCAN,

MAC_MLME_REQ_SET,

MAC_MLME_REQ_START,

MAC_MLME_REQ_SYNC,

MAC_MLME_REQ_POLL,

MAC_MLME_RSP_ASSOCIATE,

MAC_MLME_RSP_ORPHAN,

JN-RM-2002 v1.7 ? Jennic 2007 13

Jennic

MAC_MLME_REQ_VS_EXTADDR,

NUM_MAC_MLME_REQ /* (endstop) */

} MAC_MlmeReqRspType_e;

The second field u8ParamLength carries the size in bytes of the parameter

associated with the request. The parameter has a maximum size of 255 bytes

The third field ensures proper alignment of the fourth field.

The fourth field uParam is of type MAC_MlmeReqRspParam_u, a union of all the

data structures associated with the requests listed in MAC_MlmeReqRspType_e

The union is defined as follows:

/* MLME Request/Response Parameter union

* Union of all the possible MLME Requests and Responses,

* also including the vendor-specific requests

*/

union

{

/* MLME Requests */

MAC_MlmeReqAssociate_s sReqAssociate;

MAC_MlmeReqDisassociate_s sReqDisassociate;

MAC_MlmeReqGet_s sReqGet;

MAC_MlmeReqGts_s sReqGts;

MAC_MlmeReqReset_s sReqReset;

MAC_MlmeReqRxEnable_s sReqRxEnable;

MAC_MlmeReqScan_s sReqScan;

MAC_MlmeReqSet_s sReqSet;

MAC_MlmeReqStart_s sReqStart;

MAC_MlmeReqSync_s sReqSync;

MAC_MlmeReqPoll_s sReqPoll;

/* MLME Responses */

MAC_MlmeRspAssociate_s sRspAssociate;

MAC_MlmeRspOrphan_s sRspOrphan;

/* Vendor Specific Requests */

MAC_MlmeReqVsExtAddr_s sReqVsExtAddr;

} MAC_MlmeReqRspParam_u;

The individual data structures that make up the union will be dealt with in more

detail in the section on MAC and PHY features, which explains the operations that

the higher layer can request using this interface.

The psMlmeSyncCfm parameter is a pointer to a structure holding the results of the

MLME request (the confirm), generated if the request executes synchronously (ie

returns with the results immediately, rather than the results being posted as a

deferred confirm some time later). If the MLME request is one that generates a

deferred confirm, a synchronous confirm is still generated but with a status of

MAC_MLME_CFM_DEFERRED (see below).

14 ? Jennic 2007 JN-RM-2002 v1.7

Jennic

The structure is of type MAC_MlmeSyncCfm_s defined below

/* MLME Synchronous Confirm

*

* The object returned by vAppApiMlmeRequest containing

* the synchronous confirm

* All Confirms may also be sent asynchronously via the

* registered Deferred Confirm/Indication callback.

* This is notified by returning MAC_MLME_CFM_DEFERRED.

* The confirm type is implied, corresponding to the

* request

*/

typedef struct

{

uint8 u8Status;

uint8 u8ParamLength;

uint16 u16Pad;

MAC_MlmeSyncCfmParam_u uParam;

} MAC_MlmeSyncCfm_s;

The first field carries the status of the request which caused the confirm, and the

values it may take are defined by the enumeration MAC_MlmeSyncCfmStatus_e

/* Synchronous confirm status

*

* Indicates in the synchronous confirm whether:

* (1) The request was processed without error

* (2) The request was processed with errors

* (3) The confirm will be deferred and posted via the

* Deferred Confirm/Indication callback

* (4) It is a dummy confirm to a Response.

* Note: must not exceed 256 entries

*/

typedef enum

{

MAC_MLME_CFM_OK,

MAC_MLME_CFM_ERROR,

MAC_MLME_CFM_DEFERRED,

MAC_MLME_CFM_NOT_APPLICABLE,

NUM_MAC_MLME_CFM /* (endstop) */

} MAC_MlmeSyncCfmStatus_e;

The second field u8ParamLength carries the size in bytes of the parameter

associated with the confirm. The parameter has a maximum size of 255 bytes

The third field ensures proper alignment of the fourth field.

The fourth field uParam is of type MAC_MlmeSyncCfmParam_u, a union of all the

data structures associated with the confirms that can come back from requests to

the MLME, including vendor-specific requests

JN-RM-2002 v1.7 ? Jennic 2007 15

Jennic

The union is defined as follows:

/* MLME Synchronous Confirm Parameter union

*

* Union of all the possible MLME Synchronous Confirms,

* including the vendor-specific confirms

*/

typedef union

{

MAC_MlmeCfmAssociate_s sCfmAssociate;

MAC_MlmeCfmDisassociate_s sCfmDisassociate;

MAC_MlmeCfmGet_s sCfmGet;

MAC_MlmeCfmGts_s sCfmGts;

MAC_MlmeCfmScan_s sCfmScan;

MAC_MlmeCfmSet_s sCfmSet;

MAC_MlmeCfmStart_s sCfmStart;

MAC_MlmeCfmPoll_s sCfmPoll;

MAC_MlmeCfmReset_s sCfmReset;

MAC_MlmeCfmRxEnable_s sCfmRxEnable;

MAC_MlmeCfmVsBbcReg_s sCfmVsBbcReg;

MAC_MlmeCfmVsRdReg_s sCfmVsRdReg;

} MAC_MlmeSyncCfmParam_u;

Examples of using the call and setting up the parameters and interpreting the

results will be given throughout the remainder of the document.

16 ? Jennic 2007 JN-RM-2002 v1.7

Jennic

3.1.2 NWK to MCPS

Declaration PUBLIC void

vAppApiMcpsRequest(MAC_McpsReqRsp_s *psMcpsReqRsp,

MAC_McpsSyncCfm_s *psMcpsSyncCfm);

Inputs MAC_McpsReqRsp_s *psMcpsReqRsp Pointer to a structure holding the request to the

MCPS interface

MAC_McpsSyncCfm_s *psMcpsSyncCfm Pointer to a structure used to hold the result of a

synchronous confirm to a request over the MCPS

interface

Outputs None

Description Routine used to pass MCPS requests from the NWK layer or Application to the MAC.

The psMcpsReqRsp parameter is a pointer to a structure holding the request to the

MCPS. The structure is of type MAC_MlmeReqRsp_s, defined below

/* MCPS Request/Response object

*

* The object passed to vAppApiMcpsRequest containing the

* request/response

*/

typedef struct

{

uint8 u8Type;

uint8 u8ParamLength;

uint16 u16Pad;

MAC_McpsReqRspParam_u uParam;

} MAC_McpsReqRsp_s;

The structure consists of 4 fields. The first, u8Type defines the type of request or

response that the structure carries; values carried in this field are defined in the

enumeration MAC_McpsReqRspType_e shown below:

/* MAC MCPS Request/Response enumeration.

* Note must not exceed 256 entries

*/

typedef enum

{

MAC_MCPS_REQ_DATA = 0,

MAC_MCPS_REQ_PURGE,

NUM_MAC_MCPS_REQ /* (endstop) */

} MAC_McpsReqRspType_e;

The second field u8ParamLength carries the size in bytes of the parameter

associated with the request. The parameter has a maximum size of 255 bytes

The third field ensures proper alignment of the fourth field.

The fourth field uParam is of type MAC_McpsReqRspParam_u, a union of all the data

structures associated with the requests listed in MAC_McpsReqRspType_e

The union is defined as follows:

/* MCPS Request/Response Parameter union

JN-RM-2002 v1.7 ? Jennic 2007 17

Jennic

* Note there are no Responses currently specified

*/

typedef union

{

MAC_McpsReqData_s sReqData; /* Data request */

MAC_McpsReqPurge_s sReqPurge; /* Purge request */

} MAC_McpsReqRspParam_u;

The individual data structures, which make up the union, will be dealt with in more

detail in the section on MAC and PHY features, which explains the operations that

the NWK layer or Application can request using this interface.

The psMcpsSyncCfm parameter is a pointer to a structure holding the results of the

MCPS request (the confirm), generated if the request executes synchronously (i.e.

returns with the results immediately, rather than the results being posted as a

deferred confirm some time later).

The structure is of type MAC_McpsSyncCfm_s defined below

/**

* MCPS Synchronous Confirm

* The object returned by vAppApiMcpsRequest containing

* the synchronous confirm.

* The confirm type is implied as corresponding to the

* request

* All Confirms may also be sent asynchronously via the

* registered Deferred Confirm/Indication callback;

* this is notified by returning MAC_MCPS_CFM_DEFERRED.

*/

typedef struct

{

uint8 u8Status;

uint8 u8ParamLength;

uint16 u16Pad;

MAC_McpsSyncCfmParam_u uParam;

} MAC_McpsSyncCfm_s;

The first field carries the status of the request which caused the confirm, and the

values it may take are defined by the enumeration MAC_McpsSyncCfmStatus_e

/* Synchronous confirm status

*

* Indicates in the synchronous confirm whether:

* (1) The request was processed without error

* (2) The request was processed with errors

* (3) The confirm will be deferred and posted via the

* Deferred Confirm/Indication callback

* Note: must not exceed 256 entries

*/

typedef enum

{

MAC_MCPS_CFM_OK,

MAC_MCPS_CFM_ERROR,

MAC_MCPS_CFM_DEFERRED,

NUM_MAC_MCPS_CFM /* (endstop) */

} MAC_McpsSyncCfmStatus_e;

18 ? Jennic 2007 JN-RM-2002 v1.7

Jennic The second field u8ParamLength carries the size in bytes of the parameter

associated with the confirm. The parameter has a maximum size of 255 bytes.

The third field ensures proper alignment of the fourth field.

The fourth field uParam is of type MAC_McpsSyncCfmParam_u, a union of all the

data structures associated with the confirms that can come back from requests to

the MCPS, including vendor-specific requests

The union is defined as follows:

/* MCPS Synchronous Confirm Parameter union

*

* Union of all the possible MCPS Synchronous Confirms

*/

typedef union

{

MAC_McpsCfmData_s sCfmData;

MAC_McpsCfmPurge_s sCfmPurge;

} MAC_McpsSyncCfmParam_u;

Examples of using the call and setting up the parameters and interpreting the

results will be given throughout the remainder of the document.

JN-RM-2002 v1.7 ? Jennic 2007 19

Jennic

3.2 MAC layer to Network layer interface

Communication from the MAC up to the application or network layer is through callback routines implemented by the upper layer and registered with the MAC at system initialisation. In this way, the upper layer can implement the method of dealing with indications and confirmations that suits it best.

3.2.1 MLME/MCPS to NWK

Declaration PUBLIC uint32

u32AppApiInit(PR_GET_BUFFER prMlmeGetBuffer,

PR_POST_CALLBACK prMlmeCallback,

void *pvMlmeParam,

PR_GET_BUFFER prMcpsGetBuffer,

PR_POST_CALLBACK prMcpsCallback,

void *pvMcpsParam);

Inputs PR_GET_BUFFER prMlmeGetBuffer Pointer to routine which is called by the MAC to

provide a buffer to place the result of a deferred

MLME callback or indication for sending to the

network layer

PR_POST_CALLBACK prMlmeCallback Pointer to routine which is called by the MAC to post

(send) the buffer provided by the registered

prMlmeGetBuffer routine up to the network layer void *pvMlmeParam Untyped pointer which is passed when calling the

registered prMlmeGetBuffer and prMlmeCallback

routines

PR_GET_BUFFER prMcpsGetBuffer Pointer to routine which is called by the MAC to

provide a buffer to place the result of a deferred

MCPS callback or indication for sending to the

network layer

PR_POST_CALLBACK prMcpsCallback Pointer to routine which is called by the MAC to post

(send) the buffer provided by the registered

prMcpsGetBuffer routine up to the network layer void *pvMcpsParam Untyped pointer which is passed when calling the

registered prMcpsGetBuffer and prMcpsCallback

routines

Outputs uint32 0 if initialisation failed, otherwise a 32-bit version number (most significant

16 bits are main revision, least significant 16 bits are minor revision) Description This routine registers five functions provided by the network layer, which are used by the MAC and the Integrated Peripherals API to communicate with the network

layer.

Parameter 1: prMlmeGetBuffer

This is a routine that must provide a pointer to a buffer of type

MAC_DcfmIndHdr_s, which can be used by the MAC to send the results of

deferred (asynchronous) confirms as the result of a previous MLME Requests.

The same routine will also be called by the MAC to provide space to send

information to the network layer in the form of MLME Indications triggered by

hardware events.

20 ? Jennic 2007 JN-RM-2002 v1.7

excel表格的各函数常用函数

excel表格的各函数的基本操作 常用函数如下: 1、SUM()求和、总分函数 例:=SUM(B2:B5) 2、A VERAGE()求平均函数 例:=A VERAGE(B2:B5) 3、MIN()求最小值函数 例:=MIN(B2:B5) 4、MAX()求最大值函数 例:=MAX(B2:B5) 5、COUNTIF()求条件统计函数( 例:=COUNTIF(B7:B33,“>=90”) 6、COUNT()求统计函数 例:=COUNT(B7:B33) 7、IF()求逻辑函数 例:=IF(G7>=90,“优秀”,IF(G7>=80,“良好”,IF(G7)>=70,“中等”,IF(AND(G7<70,G7>0),“差生”,“没参考”)))) 8、RANK()求名次函数 例:=RANK(G7,$G$7:$G$33) 9、NOW()求电脑现在日期 例:=NOW() 10、求“性别”函数 例:=IF(MOD(MID(B6,15,1),2)=0,"女","男") 11、求“出生日期”函数 例:=CONCATENA TE(MID(B6,7,2),"-",MID(B6,9,2),"-",MID(B6,11,2)) 12、求“年龄”、“工龄”函数 例:=DATEDIF(E6,NOW(),"Y") 13、求“等级”函数 例:=IF(C6="基础班","入门级",IF(OR(C6="AUTOCAD班",C6="PHOTOSHOP",C6="CORELDRAW"),"平面设计级",IF(C6="综合班","综合办公应用级",IF(C6="OFFICE套班","办公应用级","网络设计级")))) 14、SUNIF()条件求和函数(根据指定的条件求和) 例:=SUMIF(B7:B33,">=100") 例:=SUMIF(C7:C36,"=人事",D7:D36)

04 FunCode C 开发常用API

FunCode C开发常用API C语言标准库函数 在实验中,我们需要用到一些C语言标准库函数,主要用于字符串处理,获得随机值,处理数学函数等。 Math.h 函数原型功能与返回值参数说明与应用举例 public static double atan2( double y, double x );返回两点之间的正 切值 x:点的x坐标 y:点的y坐标 float ftan = atan2((fMouseY-fY),(fMouseX-fX)); float sqrt( float x ); 功能:计算平方根 返回值:x的平方根 sqrt(9) = 3 Stdio.h 函数原型功能与返回值参数说明与应用举例 int sprintf( char *buffer, const char *format, [ argument] … ); 把格式化的数据写 入某个字符串缓冲 区。 返回值:字符串长 度(strlen) buffer:char型指针,指向将要写入的 字符串的缓冲区。 format:char型指针,指向的内存里面 存放的将要格式字符串。 [argument]...:可选参数,可以是任何类 型的数据。 sprintf(szUfoName,"ufo_%d_%d", iLoop, iTotalUfoCount ); String.h 函数原型功能与返回值参数说明与应用举例 extern char *strstr( char *str1, char *str2 );找出str2字符串 在str1字符串中 第一次出现的位置 (不包括str2的 串结束符)。 返回值:返回该位 置的指针,如找不 到,返回空指针。 strstr(szName, “feichong”) != NULL 说明szName中包含feichong 可以用来判断前一个字符串包含后面 一个字符串 extern int strcmp( const char *s1, const char * s2 );比较字符串s1和 s2。 当s1

Delphi Api

auxGetDevCaps API 获取附属设备容量 auxGetNumDevs API 返回附属设备数量 auxGetVolume API 获取当前卷设置 auxOutMessage API 向输出设备发送消息 auxSetVolume API 设置附属设备卷 AbortDoc API 终止一项打印作业 AbortPath API 终止或取消DC中的一切路径 AbortPrinter API 删除打印机缓冲文件AbortSystemShutdown API 停止系统工作 AccessCheck API 检验客户访问权限AccessCheckAndAuditAlarm API 检验访问,产生声音或警报ActivateKeyboardLayout API 激活一个新的键盘设备AddAccessAllowedAce API 将ACCESS_ALLOWED_ACE加入ACL AddAccessDeniedAce API 将ACCESS_DENIED_ACE加入ACL AddAce API 将ACE加入一个已存在的ACL AddAtom API 将一个字符串加入本地原子表AddAuditAccessAce API 将SYSTEM_AUDIT_ACE加入ACL AddFontResource API 将一种字体加入字体表 AddForm API 加入一个打印机窗体 AddJob API 启动一个打印作业 AddMonitor API 加入一个打印机管理器 AddPort API 加入一个打印机端口 AddPrintProcessor API 将打印处理器复制到打印机服务器中AddPrintProvidor API 加入一个打印机支持器 AddPrinter API 在打印机服务器上建立一个打印机AddPrinterConnection API 为当前用户建立与打印机的联系AddPrinterDriver API 将打印机驱动程序复制到打印机服务器中AdjustTokenGroups API 使能/取消令牌中的群AdjustTokenPrivileges API 使能/取消令牌特权AdjustWindowRect API 计算所需窗口矩形的大小AdjustWindowRectEx API 计算所需窗口矩形的大小AdvancedDocumentProperties API 进行打印机高级设置AllocConsole API 为当前进程建立控制台AllocateAndInitializeSid API 分配和初始化SID AllocateLocallyUniqueId API 分配LUID AngleArc API 按指定角度画弧 AnimatePalette API 替换逻辑调色板中的项目 AnyPopup API 标识弹出式窗口是否存在 AppendMenu API 在菜单中加入新的项目 Arc API 画弧 ArcTo API 画椭圆弧 AreAllAccessesGranted API 检查所有要求的访问AreAnyAccessesGranted API 检查任何要求的访问ArrangeIconicWindows API 排列最小化的子窗口

常用MFC和API函数

常用MFC和API函数 索引 CArchive类:用于二进制保存档案 CBitmap类:封装Windows的图形设备接口(GDI)位图 CBrush类:封装图形设备接口(GDI)中的画刷 CButton类:提供Windows按钮控件的功能 CByteArray类:该类支持动态的字节数组 CCmdUI类:该类仅用于ON_UPDATE_COMMAND_UI处理函数中 CColorDialog类:封装标准颜色对话框 CDC类:定义设备环境对象类 CDialog类:所有对话框(模态或非模态)的基类 CDocument类:提供用户定义的文档类的基本功能 CEdit类:是一个用于编辑控件的类 CFile类:该类是基本文件类的基类 CFileDialog类:封装了打开和保存文件的标准对话框 CFindReplaceDialog类:封装了标准查找/替换对话框 CFont类:封装了Windows图形设备接口(GDI)中的字体对象 CFontDialog类:封装了字体选择对话框 CGdiObject类:GDI绘图工具的基类 CIPAddressCtrl类:提供了IP地址控件的功能 CImageList类:管理大小相同的图标或位图集 CMenu类:封装应用程序菜单栏和弹出式菜单 CPen类:封装了Windows图形设备接口(GDI)中的画笔对象 CPoint类:操作CPoint和POINT结构 CRect类:封装了一个矩形区域及相关操作 CRgn类:封装用于操作窗口中的椭圆、多边形或者不规则区域的GDI区域 CSize类:用于表示相对坐标或位置 CSpinButtonCtrl类:旋转控件Spin的控制类 CStatusBar类:状态栏窗口的基类 CString类:处理字符串 CStringList类:支持CString对象的列表 CWinApp类:派生的程序对象的基类 CWnd类:提供所有窗口类的基本函数 API函数 CArchive类:用于二进制保存档案 CArchive::CArchive 建立一个CArchive对象 CArchive(CFile* pFile,UINT nMode,int nBufSize=4096,void* lpBuf=NULL); 参数:pFile 指向CFile对象的指针,这个CFile对象是数据的最终源或目的;nMode是标志,取值为CArchive::load时,从文档中加载数据(要求CFile读许可),取值为CArchive::store时,将数据存入文档(要求CFile写许可);nBufSize 指定内部文件缓冲区的大小(按字节计); lpBuf 指向大小为nBufSize的缓冲区,若未指定,则从局部堆中分配一缓冲区,

DELPHI常用组件

Delphi常用组件的使用 目录 1.按钮类组件 1.1Button组件

Button组件位于Standard页。 Button组件的常用属性表 属性描述 Cation用于在按钮上显示文本内容 Cancel用来指定按钮是否为取消按钮 Default用于指定按钮是否为默认按钮,在按Enter键时也选中命令按钮Hint设置鼠标在组件上短暂停时在组件旁显示的提示小窗口的内容ShowHint确定是否显示提示文本,默认值是FALSE 1.2Bitbtn组件 Bitbtn组件(位图组件)位于Additional,与Button很相似,只是多了一个位图符号在按钮上(如带有对号的OK,问好的Help等),其某些属性与Button类似,下表为其独有的的特性。(注:此组件不需编写代码) Bitbtn组件的常用属性表 属性描述 Kind Kind属性的值就是位图按钮上显示的图标。Kind属性后的下拉列表中有一组默认图标的属性值,有bkCancel(取消)、bkAbort(终止)、bkAll(所有)、 bkClose(关闭)等。 Glyph用于在位图按钮上显示加载后的位图图形 NumGlyphs用于指明位图按钮所能使用位图的个数。在delphi中,最多允许向一个位图按钮提供4个图像文件,用于表示4中不停状态 Layout用于指出位图图形在位图组件上的放置位置 1.3SpeedButton组件 SpeedButton组件(加速按钮)位于Additional,常放置在Panel组件上,用于设计工具栏。它与Bitbtn相似,也可以显示图像和文本,但通常只用于显示图像。 SpeedButton组件的常用属性表 属性描述 AllowAllUp用于设置同一组的加速按钮是否具有同时弹起的状态。若设置为FALSE,则当同一组加速按钮中的一个被按下时,其他加速按钮都处于弹起状态,即这 组按钮必须有且只有一个处于按下状态 Down用于设置该加速按钮是否处于按下状态,若设置为TRUE,则表示按钮处于按下状态 Flat用于设置在鼠标移动到该按钮上时,按钮是否显示三维效果。为FLASE则不出现 GroupIndex用于将数个加速按钮设置成一组,只需将其值设置成不等于0的数值即可1.4RadioButton组件

excel函数公式图文说明教程

excel函数公式实例教程 excel教程珍藏版,简单明了,包你学会,欢迎转载! 教程在陆续上传添加中,敬请期待! 1、PERCENTILE函数实例:求百分比数值点 Excel中PERCENTILE函数实例:求百分 比数值点 [日期:2010-08-09] 来源:IT部落窝作者:IT部落窝阅读:8560次[字体:大中小] Excel中PERCENTILE函数的用法是:返回区域中数值的第 K 个百分点的值。 PERCENTILE函数实例:求百分比数值点 下面是IT部落窝某几天的一个流量表,详见下图。现在要统计出90%、80%、70%、60%、50%对应的百分比数值点。我们使用PERCENTILE函数设计公式来求取。 操作步骤如下:

第一步,选中B17单元格,输入公式:=PERCENTILE(C2:C14,0.9),确定,得到90%处的对应的百分比数值点。 第二步,选中B18单元格,输入公式:=PERCENTILE(C2:C14,0.8),确定,得到80%处的对应的百分比数值点。 第三步,选中B19单元格,输入公式:=PERCENTILE(C2:C14,0.7),确定,得到70%处的对应的百分比数值点。 第四步,选中B20单元格,输入公式:=PERCENTILE(C2:C14,0.6),确定,得到60%处的对应的百分比数值点。 第五步,选中B21单元格,输入公式:=PERCENTILE(C2:C14,0.5),确定,得到50%处的对应的百分比数值点。 2、frequency函数实例:统计一组数据出现的次数

frequency函数实例:统计一组数据出 现的次数 [日期:2010-08-06] 来源:IT部落窝作者:IT部落窝阅读:5390次[字体:大中小] 下表中统计了公司员工被投诉的记录。问题是统计出指定的员工编号被投诉的出现次数。 我们使用excel中frequency函数可以实现出现次数统计。frequency函数用于计算数值在某个区域内的出现频率次数,然后返回一个垂直数组。 操作步骤如下: 首先在C列建立需要参与统计投诉出现次数的员工编号,然后选中D5:D8单元格区域,在编辑栏输入公式:=FREQUENCY(B2:B11,C5:C8),然后按下“Ctrl+Shift+Enter”组合键,即可一次性统计出各个编号在B2:B11单元格区域中出现的次数。 3、frequency函数用法介绍 Excel中frequency函数用法介绍 [日期:2010-08-06] 来源:IT部落窝作者:IT部落窝阅读:6622次[字体:大中小]

常用API函数参数

常用API函数参数5 ImmIsIME 函数功能: 判断指定的句柄是否为IME; 函数原型: BOOL ImmIsIME( HKL hKL ); 参数hKL: 待检查的键盘布局句柄; 返回值: 函数调用成功返回1,失败返回0. 速查信息: Windows NT: 要求4.0或更高版本 Windows: 要求Windows 95 或更高. Windows CE:不支持. Header: 声明在imm.h. Import Library: imm32.lib. Windows XP没有自带五笔型输入法,这对五笔型用户而言无疑是个大大的遗憾。网上的五笔型输入法虽然种类很多,也不乏优秀的版本,但一方面有些版本是共享软件需要注册,另一方面也许很多五笔型输入法的老用户最习惯用的还是老牌的“王码五笔型输入法86/98版”。 微软的Office XP软件中包含了这个老牌的五笔型输入法,但如果用户并不使用Office XP中的任何组件,仅仅是为了使用“王码五笔型输入法”而运行Office XP安装程序,就显的有些小题大做了,更不用说是某些零时在外面用公用电脑而又想用五笔型输入法的情况。于是网上出现了很多简化的安装方法,大体上可以分为三个步骤: 拷贝输入法文件(从Of还是9x/ME。示例代码fice XP光盘中或已经安装了“王码五笔型输入法”的电脑中提取) 增加注册表项 重启后通过控制面板添加输入法

整个过程中拷贝输入法文件和增加注册表项可以用批处理和导入注册表文件来简化操作,但必须重启计算机才能在控制面板里添加输入法,这同样让使用者觉得比较烦琐。那么作为一个编程爱好者能不能通过写个小程序来实现在不重新启动计算机的情况下全自动的安装“王码五笔型输入法”呢(也就是即装即用)?答案是肯定的!因为微软的Office XP 安装程序做到了,这就表示微软肯定留有一个专门用来安装输入法的接口,一般来说应该是一系列API函数。 经过一番摸索,笔者在MSDN里找到了这个可以用来安装输入法的API:ImmInstallIME()。Ok,现在我们就开始利用这个API来实现自己的“王码五笔型输入法”全自动安装程序。 一、准备素材 我们先试着从Office XP光盘中提取“王码五笔型输入法”的输入法文件。通过Windows 的查找功能在Office XP的第一张安装盘中查找与“WINWB”相关的文件,在OFFICE1.CAB 中找到了一下14个文件:WINWB86.CHM.*、https://www.doczj.com/doc/182987933.html,T.*、WINWB86.HLP.*、WINWB86A.IME.*、WINWB86A.MB.*、WINWB86W.IME.*、WINWB86W.MB.*、WINWB98.CHM.*、https://www.doczj.com/doc/182987933.html,T.*、WINWB98.HLP.*、WINWB98A.IME.*、WINWB98A.MB.*、WINWB98W.IME.*、WINWB98W.MB.*,其中*是很长的一串由字母、数字和下滑线组成的序列(个人认为应该是微软为了校验文件内容的正确性而加上的内容为该文件效验码的后缀吧)。去掉这个长长的后缀,可以看到5 种类型的文件。很明显,*.CHM、*.CNT和*.HLP是五笔型输入法的帮助文件,*.MB是码表文件,而*.IME是主要的输入法文件。其中*.IME和*.MB有文件名部分以A结尾和以W结尾两个版本,经过笔者试验证实了它们分别是ANSI和UNICODE两种版本的输入法文件。文件名部分以A结尾的文件适用于Windows 9x,以W结尾的文件适用于NT系列Windows系统。 提取了输入法文件后必须让安装程序针对不同版本的操作系统将它们拷贝到正确的目录,以便调用API来进行输入法安装。笔者分别在安装了Office XP中自带的“王码五笔型输入法”的Windows 98SE和Windows XP操作系统中查找以上文件,发现帮助文件都存放在WINDOWSHELP目录中(这里假设Windows系统都安装在WINDOWS目录)。而主要的输入法文件(*.IME)和码表文件(*.MB)在Windows 9x下存放于WINDOWSSYSTEM目录中,在NT系列Windows系统中存放于WINDOWSSYSTEM32目录中。 二、相关API函数 素材的准备工作已经完成,现在我们来看一下代码编写过程中需要用到的4个主要的API函数。 2.1 GetVersion 函数原型:

C语言标准库函数

标准库函数 本附录描述了标准C支持的库函数①。使用此附录时,请记住下列要点。 为了简洁清楚,这里删除了一些细节。如果想看全部内容,请参考标准。本书的其他地方已经对一些函数(特别是printf函数、scanf函数以及它们的变异函数)进行了详细介绍,所以这里 只对这类函数做简短的描述。为了获得关于某个函数更详细的信息(包括如何使用这个函数的示 例),请见函数描述右下角用楷体列出的节号。 每个函数描述结尾都有其他与之相关函数的列表。相似函数非常接近于正在描述的函数。相关函数经常会和在描述的函数联合使用。(例如,calloc函数和realloc函数与malloc函数“类似”, 而free函数则与malloc函数“相关”。)也可参见的函数和在描述的函数没有紧密联系,但是却 可能有影响。 如果把函数行为的某些方面描述为由实现定义的,那么这就意味着此函数依赖于C库的实现方式。 函数将始终行为一致,但是结果却可能会由于系统的不同而千差万别。(换句话说,请参考手册了 解可能发生的问题。)另一方面,未定义的行为是一个不好的消息:不但函数的行为可能会因系统 不同而不同,而且程序也可能会行为异常甚至崩溃。 中许多函数的描述提到了定义域错误和取值范围错误。在本附录的末尾对这两种错误进行了定义。 601 下列库函数的行为是会受到当前地区影响的: 字符处理函数(除了isdigit函数和isxdigit函数)。 格式化输入/输出函数。 多字节字符和字符串函数。 字符串转换函数。 Strcoll函数、strftime函数和strxfrm函数。 例如,isalpha函数实际上检测字符是否在a到z之间或者在A到Z之间。在某些区域内也把其他字符看成是字母次序的。本附录描述了在"C"(默认的)地区内库函数的行为。 一些函数实际上是宏。然而,这些宏的用法和函数完全一样,所以这里不对它们区别对待。 abort 异常终止程序 void abort(void); 产生SIGABRT信号。如果无法捕获信号(或者如果信号处理函数返回),那么程序会异常 终止,并且返回由实现定义的代码来说明不成功的终止。是否清洗输出缓冲区,是否关 闭打开的流,以及是否移除临时文件都是由实现定义的。 相似函数exit函数、raise函数 相关函数assert函数、signal函数 也可参见atexit函数 26.2节abs 整数的绝对值 int abs(int j); 返回整数j的绝对值。如果不能表示j的绝对值,那么函数的行为是未定义的。 ①这些材料经ANSI许可改编自American National Standards Institude ANSI/ISO 9899?1990。这个标准的副本可从 ANSI购买(ANSI, 11 West 42nd Street, New York, NY 10036)。

(DELPHI)API函数大全

(DELPHI)API函数大全 1. API之网络函数 WNetAddConnection 创建同一个网络资源的永久性连接WNetAddConnection2 创建同一个网络资源的连接WNetAddConnection3 创建同一个网络资源的连接WNetCancelConnection 结束一个网络连接 WNetCancelConnection2 结束一个网络连接 WNetCloseEnum 结束一次枚举操作 WNetConnectionDialog 启动一个标准对话框,以便建立同网络资源的连接WNetDisconnectDialog 启动一个标准对话框,以便断开同网络资源的连接WNetEnumResource 枚举网络资源 WNetGetConnection 获取本地或已连接的一个资源的网络名称WNetGetLastError 获取网络错误的扩展错误信息WNetGetUniversalName 获取网络中一个文件的远程名称以及/或者UNC (统一命名规范)名称 WNetGetUser 获取一个网络资源用以连接的名字 WNetOpenEnum 启动对网络资源进行枚举的过程 2. API之消息函数 BroadcastSystemMessage 将一条系统消息广播给系统中所有的顶级窗口GetMessagePos 取得消息队列中上一条消息处理完毕时的鼠标指针屏幕位置GetMessageTime 取得消息队列中上一条消息处理完毕时的时间PostMessage 将一条消息投递到指定窗口的消息队列PostThreadMessage 将一条消息投递给应用程序RegisterWindowMessage 获取分配给一个字串标识符的消息编号ReplyMessage 答复一个消息 SendMessage 调用一个窗口的窗口函数,将一条消息发给那个窗口SendMessageCallback 将一条消息发给窗口 SendMessageTimeout 向窗口发送一条消息 SendNotifyMessage 向窗口发送一条消息 3. API之文件处理函数 CloseHandle 关闭一个内核对象。其中包括文件、文件映射、进程、线程、安全和同步对象等 CompareFileTime 对比两个文件的时间 CopyFile 复制文件 CreateDirectory 创建一个新目录 CreateFile 打开和创建文件、管道、邮槽、通信服务、设备以及控制台CreateFileMapping 创建一个新的文件映射对象 DeleteFile 删除指定文件

API函数手册

POSTEK PPLⅠAPI函数手册 G Series 条码标签打印机 Version 2.00 深圳市博思得通信发展有限公司 二○○四年

API函数库文件说明 名称:CDFPSK.dll 中文版本编号:1.X.X.X 英文版本编号:2.X.X.X 版权所有:?2004深圳市博思得通信发展有限公司。保留所有权利。 用途 本API函数库为深圳市博思得通信发展有限公司条码标签打印机的用户提供一组命令,为他们编写基于Windows9X,NT,2000,XP等操作系统的应用程序提供便利。 本API函数库仅支持本公司产品。 缩略语对照 PPLⅠ:深圳市博思得通信发展有限公司的第一套打印机编程语言(Printer Porgram Language Ⅰ)。 API:应用程序编程接口(Application Program Interface)。 Dots:像素(pixel)是一种计算机科学技术尺寸单位,原指电视图像成像的最小单位,在打印机领域表示打印机的最小打印成像单位:1dot等于一英寸除以打印机的最大分辨率。 - 对于203DPI的打印机来说, 1dot = 25.4mm/203 = 0.125mm(1dot = 1000 / 203 = 5mil); - 对于300DPI的打印机来说, 1dot = 25.4mm/300 = 0.085mm(1dot = 1000 / 300 = 3mil)。 TrueType Font:是基于Windows操作系统使用,可装卸的字体。 - 已经安装的TrueType Font,都可以被本函数使用。 使用前须知 字符串 * 字符串以双引号(“)作为起始和结束标记; *

delphi常用函数大全

delphi常用函数大全(转) Abort函数引起放弃的意外处理 Abs函数绝对值函数 AddExitProc函数将一过程添加到运行时库的结束过程表中 Addr函数返回指定对象的地址 AdjustLineBreaks函数将给定字符串的行分隔符调整为CR/LF序列Align属性使控件位于窗口某部分 Alignment属性控件标签的文字位置 AllocMem函数在堆栈上分配给定大小的块 AllowGrayed属性允许一个灰度选择 AnsiCompareStr函数比较字符串(区分大小写) AnsiCompareText函数比较字符串(不区分大小写) AnsiLowerCase函数将字符转换为小写 AnsiUpperCase函数将字符转换为大写 Append函数以附加的方式打开已有的文件 ArcTan函数余切函数 AssignFile函数给文件变量赋一外部文件名 Assigned函数测试函数或过程变量是否为空 AutoSize属性自动控制标签的大小 BackgroundColor属性背景色 BeginThread函数以适当的方式建立用于内存管理的线程 BevelInner属性控件方框的内框方式 BevelOuter属性控件方框的外框方式 BevelWidth属性控件方框的外框宽度 BlockRead函数读一个或多个记录到变量中 BlockWrite函数从变量中写一个或多个记录 BorderStyle属性边界类型 BorderWidth属性边界宽度 Break命令终止for、while、repeat循环语句 Brush属性画刷 Caption属性标签文字的内容 ChangeFileExt函数改变文件的后缀 ChDir函数改变当前目录 Checked属性确定复选框选中状态 Chr函数返回指定序数的字符 CloseFile命令关闭打开的文件 Color属性标签的颜色 Columns属性显示的列数 CompareStr函数比较字符串(区分大小写) Concat函数合并字符串 Continue命令继续for、while、repeat的下一个循环 Copy函数返回一字符串的子串 Cos函数余弦函数 Ctl3D属性是否具有3D效果 Cursor属性鼠标指针移入后的形状 Date函数返回当前的日期 DateTimeToFileDate函数将DELPHI的日期格式转换为DOS的日期格式DateTimeToStr函数将日期时间格式转换为字符串DateTimeToString函数将日期时间格式转换为字符串 DateToStr函数将日期格式转换为字符串

API函数大全

? 1. API之网络函数 ? ?WNetAddConnection 创建同一个网络资源的永久性连接 ? ?WNetAddConnection2 创建同一个网络资源的连接 WNetAddConnection3 创建同一个网络资源的连接 WNetCancelConnection 结束一个网络连接 WNetCancelConnection2 结束一个网络连接 WNetCloseEnum 结束一次枚举操作 WNetConnectionDialog 启动一个标准对话框,以便建立同网络资源的连接 WNetDisconnectDialog 启动一个标准对话框,以便断开同网络资源的连接 WNetEnumResource 枚举网络资源 WNetGetConnection 获取本地或已连接的一个资源的网络名称 WNetGetLastError 获取网络错误的扩展错误信息 WNetGetUniversalName 获取网络中一个文件的远程名称以及/或者UNC (统一命名规范)名称 WNetGetUser 获取一个网络资源用以连接的名字 WNetOpenEnum 启动对网络资源进行枚举的过程 ? ? 2. API之消息函数 ?BroadcastSystemMessage 将一条系统消息广播给系统中所有的顶级窗口GetMessagePos 取得消息队列中上一条消息处理完毕时的鼠标指针屏幕位置 GetMessageTime 取得消息队列中上一条消息处理完毕时的时间 PostMessage 将一条消息投递到指定窗口的消息队列 PostThreadMessage 将一条消息投递给应用程序 RegisterWindowMessage 获取分配给一个字串标识符的消息编号 ReplyMessage 答复一个消息 SendMessage 调用一个窗口的窗口函数,将一条消息发给那个窗口 SendMessageCallback 将一条消息发给窗口 SendMessageTimeout 向窗口发送一条消息 SendNotifyMessage 向窗口发送一条消息 ? 3. API之文件处理函数 ?CloseHandle 关闭一个内核对象。其中包括文件、文件映射、进程、线程、安全和同步对象等 CompareFileTime 对比两个文件的时间 CopyFile 复制文件 CreateDirectory 创建一个新目录 CreateFile 打开和创建文件、管道、邮槽、通信服务、设备以及控制台CreateFileMapping 创建一个新的文件映射对象 DeleteFile 删除指定文件 DeviceIoControl 对设备执行指定的操作

1C语言入门_3简单函数_3形参和实参解读

第 3 章 简单函数 3. 形参和实参
下面我们定义一个带参数的函数, 我们需要在函数定义中指明参数的个数和每个 参数的类型,定义参数就像定义变量一样,需要为每个参数指明类型,参数的命 名也要遵循标识符命名规则。例如: 例 3.4. 带参数的自定义函数
#include
void print_time(int hour, int minute) { printf("%d:%d\n", hour, minute); }
int main(void) { print_time(23, 59); return 0; }
需要注意的是, 定义变量时可以把相同类型的变量列在一起,而定义参数却不可 以,例如下面这样的定义是错的:
void print_time(int hour, minute) {

printf("%d:%d\n", hour, minute); }
学习 C 语言的人肯定都乐意看到这句话:“变量是这样定义的,参数也是这样 定义的,一模一样”,这意味着不用专门去记住参数应该怎么定义了。谁也不愿 意看到这句话:“定义变量可以这样写,而定义参数却不可以”。C 语言的设计 者也不希望自己设计的语法规则里到处都是例外, 一个容易被用户接受的设计应 该遵循最少例外原则(Rule of Least Surprise)。其实关于参数的这条规定也不 算十分例外,也是可以理解的,请读者想想为什么要这么规定。学习编程语言不 应该死记各种语法规定,如果能够想清楚设计者这么规定的原因(Rationale), 不仅有助于记忆,而且会有更多收获。本书在必要的地方会解释一些 Rationale, 或者启发读者自己去思考, 例如上一节在脚注中解释了 void 关键字的 Rationale。 [C99 Rationale]是随 C99 标准一起发布的,值得参考。 总的来说,C 语言的设计是非常优美的,只要理解了少数基本概念和基本原则就 可以根据组合规则写出任意复杂的程序, 很少有例外的规定说这样组合是不允许 的,或者那样类推是错误的。相反,C++的设计就非常复杂,充满了例外,全世 界没几个人能把 C++的所有规则都牢记于心,因而 C++的设计一直饱受争议, 这个观点在[UNIX 编程艺术]中有详细阐述。 在本书中,凡是提醒读者注意的地方都是多少有些 Surprise 的地方,初学者如 果按常理来想很可能要想错, 所以需要特别提醒一下。而初学者容易犯的另外一 些错误, 完全是因为没有掌握好基本概念和基本原理,或者根本无视组合规则而 全凭自己主观臆断所致, 对这一类问题本书不会做特别的提醒,例如有的初学者 看完第 2 章 常量、变量和表达式之后会这样打印π 的值:
double pi=3.1416; printf("pi\n");
之所以会犯这种错误,一是不理解 Literal 的含义,二是自己想当然地把变量名 组合到字符串里去, 而事实上根本没有这条语法规则。如果连这样的错误都需要 在书上专门提醒,就好比提醒小孩吃饭一定要吃到嘴里,不要吃到鼻子里,更不 要吃到耳朵里一样。 回到正题。我们调用 print_time(23, 59)时,函数中的参数 hour 就代表 23,参 数 minute 就代表 59。确切地说,当我们讨论函数中的 hour 这个参数时,我们 所说的“参数”是指形参(Parameter),当我们讨论传一个参数 23 给函数时, 我们所说的“参数”是指实参(Argument),但我习惯都叫参数而不习惯总把 形参、实参这两个文绉绉的词挂在嘴边(事实上大多数人都不习惯),读者可以 根据上下文判断我说的到底是形参还是实参。 记住这条基本原理: 形参相当于函

Delphi 文件操作集锦

Delphi 文件操作集锦 Delphi 文件操作集锦 时间:2011-5-26来源:yang 作者: peng点击: 11次Delphi 文件操作集锦 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses activex,comobj,shlobj; {$R *.dfm} function ResolveLink(const ALinkfile: String): String; var

link: IShellLink; storage: IPersistFile; filedata: TWin32FindData; buf: Array[0..MAX_PATH] of Char; widepath: WideString; begin OleCheck(CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER, IShellLink, link)); OleCheck(link.QueryInterface(IPersistFile, storage)); widepath := ALinkFile; Result := ‘unable to resolve link‘; If Succeeded(storage.Load(@widepath[1], STGM_READ)) Then If Succeeded(link.Resolve(GetActiveWindow, SLR_NOUPDATE)) Then If Succeeded(link.GetPath(buf, sizeof(buf), filedata, SLGP_UNCPRIORITY)) Then Result := buf; storage := nil; link:= nil; end; // 用法: procedure TForm1.Button1Click(Sender: TObject);

EXCEL公式手册

这个东西其实是公司一个很老的培训资料,内容非常简单,说白了就是把Excel里按F1打开帮助都能找到的东西贴出来而已。这个东西的唯一价值,只是告诉你这些公式你可能会用得到,所以老手就不必看了,也不必喷了。我在原文的基础上添加了AVERAGEIF、AVERAGEIFS、SUMIFS、COUNTIFS和IFERROR函数(适用于2007以上版本)。 Contents Chapter 0:Updates内容更新 0.1 AVERAGEIF 0.2 AVERAGEIFS、SUMIFS、COUNTIFS 0.3 IFERROR Chapter 1:Text Functions文本函数 1.1 Concatenate 1.2 Exact 1.3 Upper 1.4 Lower 1.5 Left 1.6 Right 1.7 Len 1.8 Trim 1.9 Text 1.10 Substitute Chapter 2:LOOKUP查询函数 2.1 HLookup 2.2 VLookup 2.3 Lookup Chapter 3:Date and Time日期与时间函数 3.1 Today 3.2 Year

3.4 Day 3.5 Date 3.6 Time 3.7 Hour 3.8 Minute 3.9 Second Chapter 4:Math数学函数4.1 ABS 4.2 INT 4.3 PRODUCT 4.4 MOD 4.5 Rand 4.6 ROUND 4.7 ROUNDUP 4.8 ROUNDDOWN 4.9 SumIF 4.10 SumProduct 4.11 Trunc Chapter 5:Logical逻辑函数5.1 And 5.2 Not 5.3 Or 5.4 True 5.5 False 5.6 If Chapter 6:Financial财务函数6.1 PMT

如何学好并精通C语言

程序员之路——如何学习C语言并精通C语言 程序员之路——如何学习C语言 学习C语言不是一朝一夕的事情,但也不需要花费十年时间才能精通。如何以最小的代价学习并精通C 语言是本文的主题。请注意,即使是“最小的代价”,也绝不是什么捷径,而是以最短的时间取得最多的收获,同时也意味着你需要经历艰苦的过程。 一、要读就读好书,否则不如不读 所有初学者面临的第一个问题便是:如何选择教材。好的开始是成功的一半,选择一本优秀的教材是事半功倍的关键因素。不幸的是,学校通常会帮你指定一本很差劲的C语言课本;而幸运的是,你还可以再次选择。 大名鼎鼎的谭浩强教授出了一本《C语言程序设计》,据说发行量有超过400万,据我所知,很多学校都会推荐这本书作为C语言课本。虽然本人的名字(谭浩宇)跟教授仅仅一字之差,但我是无比坚定地黑他这本书的。这本书不是写给计算机专业的学生的,而是给那些需要考计算机等级考试的其它专业学生看的。这本书的主要缺点是:例子程序非常不专业,不能教给你程序设计应该掌握的思考方式;程序风格相当地不好,会让你养成乱写代码的恶习;错误太多,曾经有人指出过这本书的上百个错误,其中不乏关键的概念性错误。好了,这本书我也不想说太多了,有兴趣大家可以百度一下:) Kernighan和Ritchie的《The C Programming Language》(中译名《C程序设计语言》)堪称经典中的经典,不过旧版的很多内容都已过时,和现在的标准C语言相去甚远,大家一定要看最新的版本,否则不如不看。另外,即使是最经典最权威的书,也没有办法面面俱到,所以手边常备一本《C语言参考手册》是十分必要的。《C语言参考手册》就是《C Reference Manual》,是C语言标准的详细描述,包括绝大多数C标准库函数的细节,算得上是最好的标准C语言的工具书。顺便提一句,最新的《C程序设计语言》是根据C89标准修订的,而《C语言参考手册》描述的是C99标准,二者可能会有些出入,建议按照C99标准学习。还有一本《C和指针》,写得也是相当地不错,英文名是《Pointers on C》,特别地强调指针的重要性,算是本书的一个特点吧。不过这本书并不十分适合初学者,如果你曾经学过C语言,有那么一些C语言的基础但又不是很扎实,那么你可以尝试一下这本书。我相信,只要你理解了指针,C语言便不再神秘。 如果你已经啃完了一本C语言教材,想要更进一步,那么有两本书你一定要看。首先是《C Traps and Pitfalls》(中译名《C陷井与缺陷》),很薄的一本小册子,内容非常非常地有趣。要注意一点,这本书是二十多年前写成的,里面提到的很多C语言的缺陷都已被改进,不过能够了解一些历史也不是什么坏事。然后你可以挑战一下《Expert C Programming》(中译名《C专家编程》),书如其名,这本书颇具难度,一旦你仔细读完并能透彻理解,你便可以放心大胆地在简历上写“精通C语言”了。 切记一个原则,不要读自己目前还看不懂的书,那是浪费生命。如果你看不懂,那你一定是缺失了某些必需基础知识。此时,你要仔细分析自己需要补充哪些内容,然后再去书店寻找讲述的这些内容的书籍。把基础知识补充完毕再回头来学习,才会真正的事半功倍。 二、Unix/Linux还是Windows,这是个很大的问题 不同的编程环境会造就出不同思维的程序员。Windows的程序员大多依赖集成开发环境,比如Visual Studio,而Unix程序员更加钟爱Makefile与控制台。显而易见,集成开发环境更容易上手,在Windows上学习C语言,只需要会按几个基本的Visutal C++工具栏按钮就可以开始写Hello, World!了,而在Unix下,你需要一些控制台操作的基本知识。有人也许认为Unix的环境更简洁,但习惯的力量是很大的,大家都很熟悉Windows的基本操作,而为了学习C语言去专门装一个Unix系统,似乎有点不划算。 对于一个只懂得Windows基本操作、连DOS是什么都不知道的新手而言,尽快做一些有趣而有意义的事情才是最重要的。用C语言写一个小程序远比学习ls、cat等命令有趣,况且我们要专注于C语言本身,就不得不暂时忽略一些东西,比如编译链接的过程、Makefile的写法等等等等。 所以我建议初学者应该以Visual C++ 6.0(不是VisualC++ .NET)或者Dev C++作为主要的学习环境,而且千万不要在IDE的使用技巧上过多纠缠,因为今后你一定要转向Unix环境的。Visual C++ 6.0使用很方便,调试也很直观,但其默认的编译器对C标准的支持并不好,而Dev C++使用gcc编译器,对C99的标准都支持良好。使用顺带提一下,很多大学的C语言课程还在使用Turbo C 2.0作为实验环境,这是相当不可取的,原因其一是TC 2.0对C标准几乎没有支持,其二是TC 2.0编译得到的程序是16位的,这对今后理解32位的程序会造成极大的困扰(当然,用djgpp之类的东西可以使TC

相关主题
文本预览
相关文档 最新文档