op_hla_interaction_pk_register()
注意: 需要 High-Level Architecture 功能
摘要
请求使用流中断(stream interrupt),将代表某种交互类型的数据包投递到指定对象。
语法
op_hla_interaction_pk_register (objid, pk_format_name, stream_index)
| 参数 | 类型 | 说明 |
|---|---|---|
objid |
Objid |
应投递代表某种交互类型的数据包的模块的对象 ID |
pk_format_name |
const char * |
指定应投递哪种交互类型的数据包格式 |
stream_index |
int |
投递数据包的流索引(通过流中断投递) |
返回类型
Compcode
完成代码,指示请求入队的成功或失败。如果请求已成功排队以供 HLA-PM 后续处理,该内核过程返回 OPC_COMPCODE_SUCCESS;如果请求无法入队,则返回 OPC_COMPCODE_FAILURE。
示例
#define REQUEST_STRM 0
#define LEAVE_STRM 1
my_id = op_id_self ();
/* Register with the HLA-PM our desire to receive */
/* two interaction packets, using two distinct streams */ op_hla_interaction_pk_register (my_id,"Send_Info", REQUEST_STRM);
op_hla_interaction_pk_register (my_id,"Stop_Listening", LEAVE_STRM);
详情
当 HLA-PM 收到一个交互时,它会将该交互转换为合适的数据包格式,并将该数据包的副本投递给每个为该数据包格式注册过的模块。每个数据包都通过内核过程中指定的流索引,以流中断的方式投递。
用途
提供了一种机制,让 HLA-PM 使用流中断将代表某种交互类型的数据包投递给模块。
错误
- 可恢复错误:Objid(
<objid>):无法将交互(<packet_name>)的注册请求入队。(由于内存分配失败)
参考
- 使用内核过程 op_hla_interaction_pk_deregister() 停止接收传入交互的通知
- 使用内核过程 op_hla_interaction_pk_struct_get() 从传入交互中提取数据块