ข้อความ
โมดูลนี้มีฟังก์ชันที่จัดการบัฟเฟอร์ข้อความ OpenThread
สรุป
| การแจกแจง | |
|---|---|
| otMessageOrigin{ | enum กำหนดต้นทางข้อความ OpenThread  | 
| otMessagePriority{ | enum กำหนดลำดับความสำคัญของข้อความ OpenThread  | 
| Typedef | |
|---|---|
| otBufferInfo | typedef struct otBufferInfoแสดงข้อมูลบัฟเฟอร์ข้อความสำหรับคิวต่างๆ ที่สแต็ก OpenThread ใช้  | 
| otMessage | typedef struct otMessageการแสดงบัฟเฟอร์ข้อความ OpenThread แบบทึบ  | 
| otMessageOrigin | typedef enum otMessageOriginกำหนดต้นทางข้อความ OpenThread  | 
| otMessagePriority | typedef enum otMessagePriorityกำหนดลำดับความสำคัญของข้อความ OpenThread  | 
| otMessageQueueInfo | typedef struct otMessageQueueInfoแสดงข้อมูลเกี่ยวกับคิวข้อความ  | 
| otMessageSettings | typedef struct otMessageSettingsแสดงการตั้งค่าข้อความ  | 
| ฟังก์ชัน | |
|---|---|
| otMessageAppend(otMessage *aMessage, const void *aBuf, uint16_t aLength) | เพิ่มไบต์ต่อท้ายข้อความ  | 
| otMessageFree(otMessage *aMessage) | voidเพิ่มพื้นที่ว่างในบัฟเฟอร์ข้อความที่จัดสรร  | 
| otMessageGetBufferInfo(otInstance *aInstance, otBufferInfo *aBufferInfo) | voidรับข้อมูลบัฟเฟอร์ข้อความ  | 
| otMessageGetLength(const otMessage *aMessage) | uint16_tดูความยาวของข้อความในหน่วยไบต์  | 
| otMessageGetOffset(const otMessage *aMessage) | uint16_tรับออฟเซ็ตข้อความในหน่วยไบต์  | 
| otMessageGetOrigin(const otMessage *aMessage) | รับข้อมูลที่มาของข้อความ  | 
| otMessageGetRss(const otMessage *aMessage) | int8_tแสดงผล RSS โดยเฉลี่ย (ความแรงของสัญญาณที่ได้รับ) ที่เชื่อมโยงกับข้อความ  | 
| otMessageIsLinkSecurityEnabled(const otMessage *aMessage) | boolระบุว่ามีการเปิดใช้การรักษาความปลอดภัยสำหรับลิงก์ให้กับข้อความหรือไม่  | 
| otMessageIsLoopbackToHostAllowed(const otMessage *aMessage) | boolระบุว่าอนุญาตการวนซ้ำข้อความกลับไปยังโฮสต์หรือไม่  | 
| otMessageIsMulticastLoopEnabled(otMessage *aMessage) | boolระบุว่าข้อความที่ระบุอาจวนซ้ำในกรณีที่เป็นที่อยู่ปลายทางมัลติแคสต์หรือไม่  | 
| otMessageQueueDequeue(otMessageQueue *aQueue, otMessage *aMessage) | voidนำข้อความออกจากคิวข้อความที่ระบุ  | 
| otMessageQueueEnqueue(otMessageQueue *aQueue, otMessage *aMessage) | voidเพิ่มข้อความต่อท้ายคิวข้อความที่กำหนด  | 
| otMessageQueueEnqueueAtHead(otMessageQueue *aQueue, otMessage *aMessage) | voidเพิ่มข้อความไว้ที่ส่วนหัว/ด้านหน้าของคิวข้อความที่กำหนด  | 
| otMessageQueueGetHead(otMessageQueue *aQueue) | แสดงผลตัวชี้ไปยังข้อความที่ส่วนหัวของคิว  | 
| otMessageQueueGetNext(otMessageQueue *aQueue, const otMessage *aMessage) | แสดงผลตัวชี้ไปยังข้อความถัดไปในคิวโดยทำซ้ำไปข้างหน้า (จาก head ถึง tail)  | 
| otMessageQueueInit(otMessageQueue *aQueue) | voidเริ่มต้นคิวข้อความ  | 
| otMessageRead(const otMessage *aMessage, uint16_t aOffset, void *aBuf, uint16_t aLength) | uint16_tจำนวนไบต์ที่อ่านจากข้อความ  | 
| otMessageResetBufferInfo(otInstance *aInstance) | voidรีเซ็ตตัวนับข้อมูลบัฟเฟอร์ข้อความที่ติดตามจำนวนบัฟเฟอร์สูงสุดที่ใช้งานพร้อมกัน  | 
| otMessageSetDirectTransmission(otMessage *aMessage, bool aEnabled) | voidตั้ง/บังคับให้ส่งต่อข้อความโดยใช้การส่งโดยตรง  | 
| otMessageSetLength(otMessage *aMessage, uint16_t aLength) | กําหนดความยาวของข้อความเป็นไบต์  | 
| otMessageSetLoopbackToHostAllowed(otMessage *aMessage, bool aAllowLoopbackToHost) | voidตั้งค่าว่าจะอนุญาตให้วนซ้ำข้อความกลับไปยังโฮสต์หรือไม่  | 
| otMessageSetMulticastLoopEnabled(otMessage *aMessage, bool aEnabled) | voidควบคุมว่าข้อความที่ระบุจะวนซ้ำในกรณีที่เป็นที่อยู่ปลายทางมัลติแคสต์หรือไม่  | 
| otMessageSetOffset(otMessage *aMessage, uint16_t aOffset) | voidตั้งค่าออฟเซ็ตข้อความเป็นไบต์  | 
| otMessageSetOrigin(otMessage *aMessage, otMessageOrigin aOrigin) | voidตั้งค่าที่มาของข้อความ  | 
| otMessageWrite(otMessage *aMessage, uint16_t aOffset, const void *aBuf, uint16_t aLength) | intเขียนไบต์ในข้อความ  | 
| โครงสร้าง | |
|---|---|
| otBufferInfo | แสดงข้อมูลบัฟเฟอร์ข้อความสำหรับคิวต่างๆ ที่สแต็ก OpenThread ใช้ | 
| otMessageQueue | แสดงคิวข้อความ OpenThread | 
| otMessageQueueInfo | แสดงข้อมูลเกี่ยวกับคิวข้อความ | 
| otMessageSettings | แสดงการตั้งค่าข้อความ | 
การแจกแจง
otMessageOrigin
otMessageOrigin
กำหนดต้นทางข้อความ OpenThread
| พร็อพเพอร์ตี้ | |
|---|---|
| OT_MESSAGE_ORIGIN_HOST_TRUSTED | ข้อความจากแหล่งที่มาที่เชื่อถือได้ในโฮสต์ | 
| OT_MESSAGE_ORIGIN_HOST_UNTRUSTED | ข้อความจากแหล่งที่มาที่ไม่น่าเชื่อถือในโฮสต์ | 
| OT_MESSAGE_ORIGIN_THREAD_NETIF | ข้อความจาก Thread Netif | 
otMessagePriority
otMessagePriority
กำหนดลำดับความสำคัญของข้อความ OpenThread
| พร็อพเพอร์ตี้ | |
|---|---|
| OT_MESSAGE_PRIORITY_HIGH | ระดับความสำคัญสูง | 
| OT_MESSAGE_PRIORITY_LOW | ระดับความสำคัญต่ำ | 
| OT_MESSAGE_PRIORITY_NORMAL | ระดับความสำคัญปกติ | 
Typedef
otBufferInfo
struct otBufferInfo otBufferInfo
แสดงข้อมูลบัฟเฟอร์ข้อความสำหรับคิวต่างๆ ที่สแต็ก OpenThread ใช้
ฟังก์ชัน
otMessageAppend
otError otMessageAppend( otMessage *aMessage, const void *aBuf, uint16_t aLength )
เพิ่มไบต์ต่อท้ายข้อความ
| รายละเอียด | |||||||
|---|---|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||||
| แสดงผลค่า | 
 | ||||||
otMessageFree
otMessageGetLength
otMessageSetLength
otMessageGetOffset
otMessageSetOffset
otMessageRead
otMessageWrite
otMessageFree
void otMessageFree( otMessage *aMessage )
เพิ่มพื้นที่ว่างในบัฟเฟอร์ข้อความที่จัดสรร
| รายละเอียด | |||
|---|---|---|---|
| พารามิเตอร์ | 
 | ||
otMessageAppend
otMessageGetLength
otMessageSetLength
otMessageGetOffset
otMessageSetOffset
otMessageRead
otMessageWrite
otMessageGetBufferInfo
void otMessageGetBufferInfo( otInstance *aInstance, otBufferInfo *aBufferInfo )
รับข้อมูลบัฟเฟอร์ข้อความ
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
otMessageGetLength
uint16_t otMessageGetLength( const otMessage *aMessage )
ดูความยาวของข้อความในหน่วยไบต์
| รายละเอียด | |||
|---|---|---|---|
| พารามิเตอร์ | 
 | ||
| การส่งคืน | ความยาวของข้อความในหน่วยไบต์ | ||
otMessageFree
otMessageAppend
otMessageSetLength
otMessageGetOffset
otMessageSetOffset
otMessageRead
otMessageSetLength
ตั้งค่า {17otMessageWrite
ตั้งค่า {17otMessageSetOffsetotMessageSetLength
otMessageGetOffset
uint16_t otMessageGetOffset( const otMessage *aMessage )
รับออฟเซ็ตข้อความในหน่วยไบต์
| รายละเอียด | |||
|---|---|---|---|
| พารามิเตอร์ | 
 | ||
| การส่งคืน | ค่าออฟเซ็ตของข้อความ | ||
otMessageFree
otMessageAppend
otMessageGetLength
otMessageSetLength
otMessageSetOffset
otMessageRead
otMessageWrite
otMessageGetOrigin
otMessageOrigin otMessageGetOrigin( const otMessage *aMessage )
รับข้อมูลที่มาของข้อความ
| รายละเอียด | |||
|---|---|---|---|
| พารามิเตอร์ | 
 | ||
| การส่งคืน | ที่มาของข้อความ  | ||
otMessageGetRss
int8_t otMessageGetRss( const otMessage *aMessage )
แสดงผล RSS โดยเฉลี่ย (ความแรงของสัญญาณที่ได้รับ) ที่เชื่อมโยงกับข้อความ
| รายละเอียด | |
|---|---|
| การส่งคืน | ค่า RSS เฉลี่ย (เป็น dBm) หรือ OT_RADIO_RSSI_INVALID หากไม่มี RSS โดยเฉลี่ย  | 
otMessageIsLinkSecurityEnabled
bool otMessageIsLinkSecurityEnabled( const otMessage *aMessage )
ระบุว่ามีการเปิดใช้การรักษาความปลอดภัยสำหรับลิงก์ให้กับข้อความหรือไม่
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
| แสดงผลค่า | 
 | ||||
otMessageIsLoopbackToHostAllowed
bool otMessageIsLoopbackToHostAllowed( const otMessage *aMessage )
ระบุว่าอนุญาตการวนซ้ำข้อความกลับไปยังโฮสต์หรือไม่
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
| แสดงผลค่า | 
 | ||||
otMessageIsMulticastLoopEnabled
bool otMessageIsMulticastLoopEnabled( otMessage *aMessage )
ระบุว่าข้อความที่ระบุอาจวนซ้ำในกรณีที่เป็นที่อยู่ปลายทางมัลติแคสต์หรือไม่
หากใช้ aMessage ร่วมกับ otMessageInfo ช่อง mMulticastLoop จากโครงสร้าง otMessageInfo จะมีความสำคัญเหนือกว่า และจะใช้แทนค่าที่ตั้งไว้ใน aMessage
โดย API นี้มีจุดประสงค์เพื่อการใช้งานร่วมกับ otIp6Send() ซึ่งคาดว่าจะมีข้อความ IPv6 ที่เตรียมไว้แล้ว
| รายละเอียด | |||
|---|---|---|---|
| พารามิเตอร์ | 
 | ||
otMessageQueueDequeue
void otMessageQueueDequeue( otMessageQueue *aQueue, otMessage *aMessage )
นำข้อความออกจากคิวข้อความที่ระบุ
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
otMessageQueueEnqueue
void otMessageQueueEnqueue( otMessageQueue *aQueue, otMessage *aMessage )
เพิ่มข้อความต่อท้ายคิวข้อความที่กำหนด
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
otMessageQueueEnqueueAtHead
void otMessageQueueEnqueueAtHead( otMessageQueue *aQueue, otMessage *aMessage )
เพิ่มข้อความไว้ที่ส่วนหัว/ด้านหน้าของคิวข้อความที่กำหนด
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
otMessageQueueGetHead
otMessage * otMessageQueueGetHead( otMessageQueue *aQueue )
แสดงผลตัวชี้ไปยังข้อความที่ส่วนหัวของคิว
| รายละเอียด | |||
|---|---|---|---|
| พารามิเตอร์ | 
 | ||
| การส่งคืน | ตัวชี้ไปยังข้อความที่ส่วนหัวของคิว หรือเป็นค่าว่างหากคิวว่างเปล่า  | ||
otMessageQueueGetNext
otMessage * otMessageQueueGetNext( otMessageQueue *aQueue, const otMessage *aMessage )
แสดงผลตัวชี้ไปยังข้อความถัดไปในคิวโดยทำซ้ำไปข้างหน้า (จาก head ถึง tail)
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
| การส่งคืน | ตัวชี้ไปยังข้อความถัดไปในคิวหลัง  aMessageหรือ NULL หากaMessage is the tail of queue. NULL is returned ifaMessageis not in the queueaQueue` | ||||
otMessageQueueInit
void otMessageQueueInit( otMessageQueue *aQueue )
เริ่มต้นคิวข้อความ
ต้องเรียกเพียงครั้งเดียวสำหรับอินสแตนซ์ otMessageQueue ก่อนฟังก์ชัน otMessageQueue อื่นๆ ไม่มีการกำหนดลักษณะการทำงานนี้ หากมีการใช้ API คิวอื่นๆ กับ otMessageQueue ก่อนที่จะเริ่มต้น หรือมีการใช้ API ของคิวอื่นๆ มากกว่า 1 ครั้ง
| รายละเอียด | |||
|---|---|---|---|
| พารามิเตอร์ | 
 | ||
otMessageRead
uint16_t otMessageRead( const otMessage *aMessage, uint16_t aOffset, void *aBuf, uint16_t aLength )
จำนวนไบต์ที่อ่านจากข้อความ
| รายละเอียด | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||||||
| การส่งคืน | จำนวนไบต์ที่อ่าน | ||||||||
otMessageFree
otMessageAppend
otMessageGetLength
otMessageSetLength
otMessageGetOffset
otMessageSetOffset
otMessageWrite
otMessageResetBufferInfo
void otMessageResetBufferInfo( otInstance *aInstance )
รีเซ็ตตัวนับข้อมูลบัฟเฟอร์ข้อความที่ติดตามจำนวนบัฟเฟอร์สูงสุดที่ใช้งานพร้อมกัน
การดำเนินการนี้จะรีเซ็ต mMaxUsedBuffers ใน otBufferInfo
| รายละเอียด | |||
|---|---|---|---|
| พารามิเตอร์ | 
 | ||
otMessageSetDirectTransmission
void otMessageSetDirectTransmission( otMessage *aMessage, bool aEnabled )
ตั้ง/บังคับให้ส่งต่อข้อความโดยใช้การส่งโดยตรง
การตั้งค่าเริ่มต้นสำหรับข้อความใหม่คือ false
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
otMessageSetLength
otError otMessageSetLength( otMessage *aMessage, uint16_t aLength )
กําหนดความยาวของข้อความเป็นไบต์
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
| แสดงผลค่า | 
 | ||||
otMessageFree
otMessageAppend
otMessageGetLength
otMessageGetOffset
otMessageSetOffset
otMessageRead
otMessageWrite
otMessageSetLoopbackToHostAllowed
void otMessageSetLoopbackToHostAllowed( otMessage *aMessage, bool aAllowLoopbackToHost )
ตั้งค่าว่าจะอนุญาตให้วนซ้ำข้อความกลับไปยังโฮสต์หรือไม่
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
otMessageSetMulticastLoopEnabled
void otMessageSetMulticastLoopEnabled( otMessage *aMessage, bool aEnabled )
ควบคุมว่าข้อความที่ระบุจะวนซ้ำในกรณีที่เป็นที่อยู่ปลายทางมัลติแคสต์หรือไม่
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
otMessageSetOffset
void otMessageSetOffset( otMessage *aMessage, uint16_t aOffset )
ตั้งค่าออฟเซ็ตข้อความเป็นไบต์
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
otMessageFree
otMessageAppend
otMessageGetLength
otMessageSetLength
otMessageGetOffset
otMessageRead
otMessageWrite
otMessageSetOrigin
void otMessageSetOrigin( otMessage *aMessage, otMessageOrigin aOrigin )
ตั้งค่าที่มาของข้อความ
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||
otMessageWrite
int otMessageWrite( otMessage *aMessage, uint16_t aOffset, const void *aBuf, uint16_t aLength )
เขียนไบต์ในข้อความ
| รายละเอียด | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| พารามิเตอร์ | 
 | ||||||||
| การส่งคืน | จำนวนไบต์ที่เขียนแล้ว | ||||||||
otMessageFree
otMessageAppend
otMessageGetLength
otMessageSetLength
otMessageGetOffset
otMessageSetOffset
otMessageRead
แหล่งข้อมูล
หัวข้ออ้างอิง API ของ OpenThread จะมาจากซอร์สโค้ดซึ่งพร้อมใช้งานใน GitHub ดูข้อมูลเพิ่มเติมหรือมีส่วนร่วมในเอกสารประกอบของเราได้ที่แหล่งข้อมูล