不知道该怎么翻译合适,不过内容很象我设计架构时的一些规范和约束. 姑且译为 TAPI 程序设计约定.
一 telephony operation分为异步和同步:
1)异步操作将一个DRV_REQUEST类型dwRequestID作为第一个参数.当操作执行时,可以在函数调用中执行一部分操作,函数返回后可以在另外一个线程中执行其余的操作.操作函数将返回一个负错误码或者正dwRequestID.
当操作最终完成时,执行线程调用ASYNC_COMPLETION,返回REQUEST ID和错误码.
这句话不明白:Service providers should always copy input data from application memory into service provider memory before returning from an asynchronous function.
2)同步操作不需要dwRequestID,也不需要调用ASYNC_COMPLETION
NOTE:If the operation completes very rapidly (or the original request returns very slowly), it is possible that the interrupt handler that runs when a physical operation completes may be triggered before the original request returns to the application or even to TAPI. This behavior is allowed. TAPI guarantees that the eventual completion notification to the application is delivered after the original request returns.
二 Memory Alloc
在TAPI 函数调用中
App负责分配传递信息所需的内存,TAPI仅仅是填写这些信息.
dwTotalSize指示数据结构总的大小,由调用APP赋值。
dwNeededSize指示需要多少字节来容纳返回的信息,由被TAPI赋值。
dwUserSize指示实际使用的字节数,由TAPI填写
当调用数据结构参数中存在可变尺寸信息时,如果dwTotalSize小于数据结构固定header大小,那么,将返回LINEERR/ PHONEERR_STRUCTURETOOSMALL.
Note: All text strings, regardless of encoding, in variably sized structures should be NULL-terminated according to normal C string-handling conventions.