nl:: বুনা:: TLV:: TLVWriter

#include <src/lib/core/WeaveTLV.h>

Weave TLV ফর্ম্যাটে ডেটা লেখার জন্য একটি মেমরি দক্ষ এনকোডার প্রদান করে।

সারসংক্ষেপ

TLVWriter ওয়েভ TLV ডেটার জন্য শুধুমাত্র ফরওয়ার্ড-স্টাইল এনকোডার প্রয়োগ করে। অ্যাপ্লিকেশানগুলি লেখকের Put() পদ্ধতিগুলির একটিতে কল করে, সংশ্লিষ্ট ট্যাগ এবং প্রয়োজনীয় তথ্যগুলিকে পাস করে একটি এনকোডিংয়ে ডেটা লেখে। একইভাবে অ্যাপ্লিকেশনগুলি লেখকের OpenContainer() বা EnterContainer() পদ্ধতিতে কল করে TLV কন্টেইনার প্রকার (কাঠামো, অ্যারে বা পাথ) এনকোড করতে পারে।

একটি TLVWriter অবজেক্ট সরাসরি একটি নির্দিষ্ট আউটপুট বাফারে বা এক বা একাধিক প্যাকেটবাফার অবজেক্টের চেইনে ডেটা লিখতে পারে। অতিরিক্তভাবে, অ্যাপ্লিকেশনগুলি তাদের নিজস্ব GetNewBuffer এবং FinalizeBuffer ফাংশনগুলিকে একটি নির্বিচারে গন্তব্যে সরাসরি আউটপুট সরবরাহ করতে পারে, যেমন একটি সকেট বা একটি ইভেন্ট সারি৷

উত্তরাধিকার

সরাসরি পরিচিত সাবক্লাস: nl::Weave::TLV::CircularTLVWriter

সুরক্ষিত প্রকার

@72 {
kEndOfContainerMarkerSize = 1
}
enum

পাবলিক প্রকার

FinalizeBufferFunct )(TLVWriter &writer, uintptr_t bufHandle, uint8_t *bufStart, uint32_t bufLen) WEAVE_ERROR(*
একটি TLVWriter অবজেক্ট থেকে আউটপুট চূড়ান্ত করার জন্য ব্যবহৃত একটি ফাংশন।
GetNewBufferFunct )(TLVWriter &writer, uintptr_t &bufHandle, uint8_t *&bufStart, uint32_t &bufLen) WEAVE_ERROR(*
একটি ফাংশন যা একটি TLVWriter এ নতুন আউটপুট বাফার স্পেস সরবরাহ করে।

পাবলিক বৈশিষ্ট্য

AppData
void *
একটি পয়েন্টার ক্ষেত্র যা অ্যাপ্লিকেশন-নির্দিষ্ট ডেটার জন্য ব্যবহার করা যেতে পারে।
FinalizeBuffer
একটি ফাংশনের একটি পয়েন্টার যা TLVWriter চূড়ান্ত হলে কল করা হবে।
GetNewBuffer
একটি ফাংশনের একটি পয়েন্টার যা একটি TLVWriter এ নতুন আউটপুট বাফার স্পেস সরবরাহ করবে।
ImplicitProfileId
uint32_t
ট্যাগের প্রোফাইল আইডি যা অন্তর্নিহিত আকারে এনকোড করা উচিত।

সুরক্ষিত বৈশিষ্ট্য

mBufHandle
uintptr_t
mBufStart
uint8_t *
mContainerType
mLenWritten
uint32_t
mMaxLen
uint32_t
mRemainingLen
uint32_t
mWritePoint
uint8_t *

পাবলিক ফাংশন

CloseContainer ( TLVWriter & containerWriter)
OpenContainer() এ কল করার পর একটি TLV কন্টেইনার লেখা সম্পূর্ণ করে।
ContinuePutBytes (const uint8_t *buf, uint32_t len)
একটি TLV বাইট স্ট্রিং মান এনকোড করে।
CopyContainer ( TLVReader & container)
TLVReader অবজেক্ট থেকে একটি TLV কন্টেইনার উপাদান কপি করে।
CopyContainer (uint64_t tag, TLVReader & container)
সদস্য উপাদানগুলির একটি প্রাক-এনকোড করা সেট থেকে একটি TLV কন্টেইনার উপাদান এনকোড করে।
CopyContainer (uint64_t tag, const uint8_t *encodedContainer, uint16_t encodedContainerLen)
একটি TLV কন্টেইনার উপাদান এনকোড করে যাতে একটি প্রাক-এনকোডেড কন্টেইনার থেকে সদস্য উপাদান থাকে।
CopyElement ( TLVReader & reader)
পাঠক বস্তু থেকে লেখকের মধ্যে একটি TLV উপাদান কপি করে।
CopyElement (uint64_t tag, TLVReader & reader)
EndContainer ( TLVType outerContainerType)
একটি TLV কন্টেইনার উপাদানের এনকোডিং সম্পূর্ণ করে।
Finalize (void)
একটি TLV এনকোডিং লেখা শেষ করুন।
GetContainerType (void) const
TLVWriter বর্তমানে যে পাত্রে লিখছে তার ধরন প্রদান করে।
GetLengthWritten (void)
uint32_t
লেখক শুরু হওয়ার পর থেকে লেখা মোট বাইট সংখ্যা প্রদান করে।
Init (uint8_t *buf, uint32_t maxLen)
void
একটি একক আউটপুট বাফারে লিখতে একটি TLVWriter অবজেক্ট শুরু করে।
Init ( PacketBuffer *buf, uint32_t maxLen)
void
একটি একক প্যাকেটবাফারে লিখতে একটি TLVWriter অবজেক্ট শুরু করে।
Init ( PacketBuffer *buf, uint32_t maxLen, bool allowDiscontiguousBuffers)
void
এক বা একাধিক প্যাকেটবাফারে লিখতে একটি TLVWriter অবজেক্ট শুরু করে।
InitMalloced (uint8_t *& outBuf, uint32_t initialBufSize, uint32_t maxLen)
void
ডায়নামিক বাফারে লিখতে একটি TLVWriter অবজেক্ট শুরু করে।
OpenContainer (uint64_t tag, TLVType containerType, TLVWriter & containerWriter)
একটি TLV কন্টেইনার উপাদানের সদস্যদের লেখার জন্য একটি নতুন TLVWriter অবজেক্ট শুরু করে।
Put (uint64_t tag, int8_t v)
একটি TLV স্বাক্ষরিত পূর্ণসংখ্যা মান এনকোড করে।
Put (uint64_t tag, int8_t v, bool preserveSize)
একটি TLV স্বাক্ষরিত পূর্ণসংখ্যা মান এনকোড করে।
Put (uint64_t tag, int16_t v)
Put (uint64_t tag, int16_t v, bool preserveSize)
Put (uint64_t tag, int32_t v)
Put (uint64_t tag, int32_t v, bool preserveSize)
Put (uint64_t tag, int64_t v)
Put (uint64_t tag, int64_t v, bool preserveSize)
Put (uint64_t tag, uint8_t v)
একটি TLV স্বাক্ষরবিহীন পূর্ণসংখ্যা মান এনকোড করে।
Put (uint64_t tag, uint8_t v, bool preserveSize)
একটি TLV স্বাক্ষরবিহীন পূর্ণসংখ্যা মান এনকোড করে।
Put (uint64_t tag, uint16_t v)
Put (uint64_t tag, uint16_t v, bool preserveSize)
Put (uint64_t tag, uint32_t v)
Put (uint64_t tag, uint32_t v, bool preserveSize)
Put (uint64_t tag, uint64_t v)
Put (uint64_t tag, uint64_t v, bool preserveSize)
Put (uint64_t tag, float v)
Put (uint64_t tag, double v)
একটি TLV ফ্লোটিং পয়েন্ট মান এনকোড করে।
PutBoolean (uint64_t tag, bool v)
একটি TLV বুলিয়ান মান এনকোড করে।
PutBytes (uint64_t tag, const uint8_t *buf, uint32_t len)
একটি TLV বাইট স্ট্রিং মান এনকোড করে।
PutNull (uint64_t tag)
একটি TLV নাল মান এনকোড করে।
PutPreEncodedContainer (uint64_t tag, TLVType containerType, const uint8_t *data, uint32_t dataLen)
সদস্য উপাদানগুলির একটি প্রাক-এনকোড করা সেট থেকে একটি TLV কন্টেইনার উপাদান এনকোড করে।
PutString (uint64_t tag, const char *buf)
একটি TLV UTF8 স্ট্রিং মান এনকোড করে।
PutString (uint64_t tag, const char *buf, uint32_t len)
একটি TLV UTF8 স্ট্রিং মান এনকোড করে।
PutStringF (uint64_t tag, const char *fmt, ...)
TLV উপাদানের বিন্যাস অনুযায়ী স্ট্রিং আউটপুট বিন্যাস এনকোড করুন।
StartContainer (uint64_t tag, TLVType containerType, TLVType & outerContainerType)
একটি নতুন TLV কন্টেইনার উপাদান এনকোডিং শুরু করে।
StartPutBytes (uint64_t tag, uint32_t totalLen)
একাধিক খণ্ডে একটি TLV বাইট স্ট্রিং এনকোড করে।
VPutStringF (uint64_t tag, const char *fmt, va_list ap)
TLV উপাদানের বিন্যাস অনুযায়ী স্ট্রিং আউটপুট বিন্যাস এনকোড করুন।

পাবলিক স্ট্যাটিক ফাংশন

FinalizePacketBuffer ( TLVWriter & writer, uintptr_t bufHandle, uint8_t *bufStart, uint32_t dataLen)
প্যাকেটবাফারের একটি চেইনে লেখার জন্য একটি TLVWriter FinalizeBuffer ফাংশনের বাস্তবায়ন।
GetNewBuffer_Malloced ( TLVWriter & writer, uintptr_t & bufHandle, uint8_t *& bufStart, uint32_t & bufLen)
একটি গতিশীল বাফারে লেখার জন্য একটি TLVWriter GetNewBuffer ফাংশনের বাস্তবায়ন।
GetNewPacketBuffer ( TLVWriter & writer, uintptr_t & bufHandle, uint8_t *& bufStart, uint32_t & bufLen)
প্যাকেটবাফারের একটি চেইনে লেখার জন্য একটি TLVWriter GetNewBuffer ফাংশনের বাস্তবায়ন।

সুরক্ষিত ফাংশন

IsCloseContainerReserved (void) const
bool
কন্টেইনারটি শুরু/খোলার সময় ক্লোজকন্টেইনার চিহ্নের জন্য ধারকটি স্থান সংরক্ষিত করবে কিনা তা নির্ধারণ করুন।
IsContainerOpen (void) const
bool
SetCloseContainerReserved (bool aCloseContainerReserved)
void
কন্টেইনার শুরু/খোলার সময় ক্লোজকন্টেইনার চিহ্নের জন্য কন্টেইনারটি স্পেস রিজার্ভ করবে কিনা তা সেট করুন।
SetContainerOpen (bool aContainerOpen)
void
WriteData (const uint8_t *p, uint32_t len)
WriteElementHead (TLVElementType elemType, uint64_t tag, uint64_t lenOrVal)
WriteElementWithData ( TLVType type, uint64_t tag, const uint8_t *data, uint32_t dataLen)

সুরক্ষিত প্রকার

@৭২

 @72

পাবলিক প্রকার

চূড়ান্ত করা বাফারফাংশন

WEAVE_ERROR(* FinalizeBufferFunct)(TLVWriter &writer, uintptr_t bufHandle, uint8_t *bufStart, uint32_t bufLen)

একটি TLVWriter অবজেক্ট থেকে আউটপুট চূড়ান্ত করার জন্য ব্যবহৃত একটি ফাংশন।

এই ধরনের ফাংশনগুলিকে বলা হয় যখন একটি TLVWriter 's Finalize() পদ্ধতি বলা হয়। ফাংশনটি রাইটার অবজেক্টের আউটপুট গ্রহণের সাথে সম্পর্কিত যেকোন প্রয়োজনীয় ক্লিন-আপ বা চূড়ান্তকরণ সম্পাদন করবে বলে আশা করা হচ্ছে। এর উদাহরণগুলির মধ্যে এনকোডিংয়ের চূড়ান্ত দৈর্ঘ্য রেকর্ড করা বা একটি ফাইল বর্ণনাকারী বন্ধ করার মতো জিনিসগুলি অন্তর্ভুক্ত রয়েছে।

বিস্তারিত
পরামিতি
[in] writer
TLVWriter অবজেক্টের একটি রেফারেন্স যা চূড়ান্ত করা হচ্ছে।
[in,out] bufHandle
একটি uintptr_t প্রসঙ্গ মান যা পূর্ববর্তী কল দ্বারা GetNewBuffer ফাংশনে সেট করা হয়েছিল।
[in,out] bufStart
বর্তমান (এবং চূড়ান্ত) আউটপুট বাফারের শুরুতে একটি পয়েন্টার।
[in,out] bufLen
bufStart দ্বারা নির্দেশিত বাফারে থাকা বাইটের সংখ্যা।
রিটার্ন মান
WEAVE_NO_ERROR
যদি চূড়ান্তকরণ সফল হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটি কোড যা নির্দেশ করে যে চূড়ান্তকরণের সময় একটি ত্রুটি ঘটেছে।

GetNewBufferFunct

WEAVE_ERROR(* GetNewBufferFunct)(TLVWriter &writer, uintptr_t &bufHandle, uint8_t *&bufStart, uint32_t &bufLen)

একটি ফাংশন যা একটি TLVWriter এ নতুন আউটপুট বাফার স্পেস সরবরাহ করে।

এই ধরনের ফাংশনগুলি একটি TLVWriter- এ লেখার জন্য নতুন বাফার স্পেস প্রস্তুত করতে ব্যবহৃত হয়। কল করা হলে, ফাংশনটি একটি মেমরি অবস্থানে একটি পয়েন্টার ফেরত দেবে বলে আশা করা হয় যেখানে একটি সংশ্লিষ্ট সর্বোচ্চ দৈর্ঘ্য সহ নতুন ডেটা লেখা উচিত। ফাংশনটি ডেটা ধরে রাখার জন্য একটি নতুন বাফার বরাদ্দ করে বা বিদ্যমান বাফার থেকে পূর্বে লিখিত ডেটা সাফ করে লেখার স্থান সরবরাহ করতে পারে।

বিস্তারিত
পরামিতি
[in] writer
TLVWriter অবজেক্টের একটি রেফারেন্স যা নতুন বাফার স্পেস অনুরোধ করছে।
[in,out] bufHandle
একটি uintptr_t মানের একটি রেফারেন্স যা ফাংশনটি কলগুলির মধ্যে প্রসঙ্গ ডেটা সংরক্ষণ করতে ব্যবহার করতে পারে। এই মানটি প্রথম কলের আগে 0 তে আরম্ভ করা হয়।
[in,out] bufStart
একটি তথ্য পয়েন্টার একটি রেফারেন্স. ফাংশনে প্রবেশ করার সময়, bufStart বর্তমান আউটপুট বাফারের শুরুতে নির্দেশ করে। প্রস্থান করার সময়, bufStart নতুন আউটপুট বাফারের শুরুতে নির্দেশ করবে বলে আশা করা হচ্ছে। নতুন পয়েন্টার মান আগের মানের মতোই হতে পারে (যেমন যদি ফাংশনটি বিদ্যমান ডেটা অন্য কোথাও কপি করে থাকে), অথবা এটি একটি সম্পূর্ণ নতুন অবস্থান নির্দেশ করতে পারে।
[in,out] bufLen
একটি স্বাক্ষরবিহীন পূর্ণসংখ্যার একটি রেফারেন্স। ফাংশনে প্রবেশ করার সময়, bufLen বর্তমান বাফারে অব্যবহৃত স্থানের বাইটের সংখ্যা ধারণ করে। প্রস্থান করার সময়, bufLen এ নতুন আউটপুট বাফারে লেখা যেতে পারে এমন সর্বাধিক সংখ্যক বাইট থাকবে বলে আশা করা হচ্ছে।
রিটার্ন মান
WEAVE_NO_ERROR
যদি ফাংশনটি লেখকের জন্য আরও বাফার স্পেস সরবরাহ করতে সক্ষম হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটি কোডগুলি নির্দেশ করে যে একটি ত্রুটি ঘটেছে যা ফাংশনটিকে অতিরিক্ত বাফার স্পেস তৈরি করতে বাধা দেয়।

পাবলিক বৈশিষ্ট্য

অ্যাপ্লিকেশন তথ্য

void * AppData

একটি পয়েন্টার ক্ষেত্র যা অ্যাপ্লিকেশন-নির্দিষ্ট ডেটার জন্য ব্যবহার করা যেতে পারে।

বাফার চূড়ান্ত করুন

FinalizeBufferFunct FinalizeBuffer

একটি ফাংশনের একটি পয়েন্টার যা TLVWriter চূড়ান্ত হলে কল করা হবে।

একটি TLVWriter অবজেক্ট FinalizeBuffer ফাংশনকে কল করবে যখনই এর Finalize() পদ্ধতি কল করা হবে। Finalize() কল করার আগে অ্যাপ্লিকেশনগুলি যে কোনও সময়ে ফাংশন পয়েন্টার সেট করতে পারে। ডিফল্টরূপে পয়েন্টারটি NULL-এ সেট করা থাকে, যার ফলে Finalize() পদ্ধতিটি ফাংশনটিকে কল করা থেকে বিরত থাকে।

একটি FinalizeBuffer ফাংশন বাস্তবায়নের অতিরিক্ত তথ্যের জন্য FinalizeBufferFunct প্রকারের সংজ্ঞা দেখুন।

GetNewBuffer

GetNewBufferFunct GetNewBuffer

একটি ফাংশনের একটি পয়েন্টার যা একটি TLVWriter এ নতুন আউটপুট বাফার স্পেস সরবরাহ করবে।

একটি TLVWriter বস্তু GetNewBuffer ফাংশনকে কল করবে যখনই বর্তমান আউটপুট বাফারের আকার অতিক্রম করে এমন ডেটা লেখার চেষ্টা করা হয়। NULL (ডিফল্ট মান) এ সেট করা হলে, আউটপুট ডেটা বর্তমান বাফারে ওভারফ্লো হলে লেখক একটি WEAVE_ERROR_NO_MEMORY ফেরত দেবেন।

GetNewBuffer যে কোনো সময়ে একটি অ্যাপ্লিকেশন দ্বারা সেট করা যেতে পারে, কিন্তু সাধারণত যখন লেখক শুরু হয় তখন সেট করা হয়।

একটি GetNewBuffer ফাংশন বাস্তবায়নের অতিরিক্ত তথ্যের জন্য GetNewBufferFunct প্রকারের সংজ্ঞা দেখুন।

অন্তর্নিহিত প্রোফাইল আইডি

uint32_t ImplicitProfileId

ট্যাগের প্রোফাইল আইডি যা অন্তর্নিহিত আকারে এনকোড করা উচিত।

যখন একজন লেখককে একটি নতুন উপাদান এনকোড করতে বলা হয়, যদি নতুন উপাদানের সাথে যুক্ত ট্যাগের প্রোফাইল আইডি ImplicitProfileId সদস্যের মানের সাথে মেলে, লেখক প্রক্রিয়ায় প্রোফাইল আইডি বাদ দিয়ে ট্যাগটিকে অন্তর্নিহিত আকারে এনকোড করবেন।

ডিফল্টরূপে, ImplicitProfileId বৈশিষ্ট্যটি kProfileIdNotSpecified-এ সেট করা থাকে, যা লেখককে নির্দেশ দেয় যে অন্তর্নিহিতভাবে এনকোড করা ট্যাগগুলি নির্গত না করতে। এনকোডিংয়ের বর্তমান বিন্দু থেকে শুরু করে অন্তর্নিহিত আকারে এনকোডিং ট্যাগগুলি সক্ষম করতে অ্যাপ্লিকেশনগুলি যে কোনও সময় ImplicitProfileId সেট করতে পারে৷ সেট করার জন্য উপযুক্ত প্রোফাইল আইডি সাধারণত অ্যাপ্লিকেশান বা প্রোটোকলের প্রেক্ষাপটের উপর নির্ভর করে।

সুরক্ষিত বৈশিষ্ট্য

mBufHandle

uintptr_t mBufHandle

mBufStart

uint8_t * mBufStart

mContainerType

TLVType mContainerType

mLen লিখিত

uint32_t mLenWritten

mMaxLen

uint32_t mMaxLen

mRemainingLen

uint32_t mRemainingLen

mWritePoint

uint8_t * mWritePoint

পাবলিক ফাংশন

ক্লোজ কনটেইনার

WEAVE_ERROR CloseContainer(
  TLVWriter & containerWriter
)

OpenContainer() এ কল করার পর একটি TLV কন্টেইনার লেখা সম্পূর্ণ করে।

OpenContainer() এ কল করার পর CloseContainer () পদ্ধতিটি একটি প্যারেন্ট TLVWriter অবজেক্টের অবস্থা পুনরুদ্ধার করে। OpenContainer() অ্যাপ্লিকেশনে প্রতিটি কলের জন্য অবশ্যই CloseContainer( ) এ একটি অনুরূপ কল করতে হবে, উভয় পদ্ধতিতে একই কন্টেইনার লেখকের একটি রেফারেন্স পাস করতে হবে।

যখন CloseContainer() ফিরে আসে, তখন অ্যাপ্লিকেশনগুলি ধারক উপাদানের পরে প্রদর্শিত অতিরিক্ত TLV উপাদানগুলি লিখতে মূল লেখককে ব্যবহার করা চালিয়ে যেতে পারে। এই মুহুর্তে সরবরাহকৃত কন্টেইনার লেখককে 'ডি-ইনিশিয়ালাইজড' হিসাবে বিবেচনা করা উচিত এবং পুনরায় আরম্ভ না করে ব্যবহার করা উচিত নয়।

বিস্তারিত
পরামিতি
[in] containerWriter
TLVWriter অবজেক্টের একটি রেফারেন্স যা OpenContainer() পদ্ধতিতে সরবরাহ করা হয়েছিল।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_INCORRECT_STATE
যদি সরবরাহকৃত কন্টেইনার লেখক সঠিক অবস্থায় না থাকে।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি সরবরাহকৃত কন্টেইনার রাইটারে অন্য কন্টেইনার রাইটার খোলা হয় এবং এখনও বন্ধ না হয়।
WEAVE_ERROR_BUFFER_TOO_SMALL
কন্টেইনারের এনকোডিং সম্পূর্ণ করা হলে লেখকের সূচনা করার সময় নির্দিষ্ট করা বাইটের সর্বোচ্চ সংখ্যার সীমা অতিক্রম করবে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

পুটবাইট চালিয়ে যান

WEAVE_ERROR ContinuePutBytes(
  const uint8_t *buf,
  uint32_t len
)

একটি TLV বাইট স্ট্রিং মান এনকোড করে।

এটি StartPutBytes এর সাথে ব্যবহার করা উচিত।

বিস্তারিত
পরামিতি
[in] buf
এনকোড করা বাইট স্ট্রিং ধারণকারী একটি বাফার একটি পয়েন্টার.
[in] len
এনকোড করা বাইট সংখ্যা.
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_INVALID_TLV_TAG
যদি নির্দিষ্ট ট্যাগ মানটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে মানটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

কপি কন্টেইনার

WEAVE_ERROR CopyContainer(
  TLVReader & container
)

TLVReader অবজেক্ট থেকে একটি TLV কন্টেইনার উপাদান কপি করে।

CopyContainer() একটি TLVReader অবজেক্টের বর্তমান অবস্থানে অবস্থিত একটি প্রাক-এনকোডেড কন্টেইনার উপাদান কপি করে একটি নতুন TLV কন্টেইনার উপাদান এনকোড করে। পদ্ধতিটি একটি কলে নতুন কন্টেইনার উপাদানের সম্পূর্ণটি লিখে, উৎস এনকোডিং থেকে কন্টেইনারের ধরন, ট্যাগ এবং উপাদানগুলি অনুলিপি করে৷ যখন পদ্ধতিটি ফিরে আসে, তখন লেখক বস্তুটি ধারক উপাদান অনুসরণ করে অতিরিক্ত TLV উপাদান লিখতে ব্যবহার করা যেতে পারে।

বিস্তারিত
পরামিতি
[in] container
একটি TLVReader অবজেক্টের একটি রেফারেন্স যা কপি করার জন্য প্রাক-এনকোড করা TLV কন্টেইনার সনাক্ত করে।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_INCORRECT_STATE
যদি সরবরাহকৃত পাঠক একটি ধারক উপাদানে অবস্থান না করে থাকে।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_TLV_UNDERRUN
যদি সরবরাহকৃত পাঠকের সাথে যুক্ত অন্তর্নিহিত TLV এনকোডিং অকালে শেষ হয়ে যায়।
WEAVE_ERROR_INVALID_TLV_ELEMENT
যদি সরবরাহ করা পাঠক একটি অবৈধ বা অসমর্থিত TLV উপাদান প্রকারের সম্মুখীন হয়।
WEAVE_ERROR_INVALID_TLV_TAG
যদি সরবরাহকৃত পাঠক একটি অবৈধ প্রসঙ্গে একটি TLV ট্যাগের সম্মুখীন হয়, অথবা যদি উৎস কন্টেইনারের সাথে যুক্ত ট্যাগটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে নতুন ধারকটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন, অথবা রিডার অবজেক্টের সাথে যুক্ত GetNextBuffer() ফাংশন দ্বারা ফেরত অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটি।

কপি কন্টেইনার

WEAVE_ERROR CopyContainer(
  uint64_t tag,
  TLVReader & container
)

সদস্য উপাদানগুলির একটি প্রাক-এনকোড করা সেট থেকে একটি TLV কন্টেইনার উপাদান এনকোড করে।

CopyContainer() পদ্ধতিটি একটি নতুন TLV কন্টেইনার উপাদান (একটি কাঠামো, অ্যারে বা পথ) এনকোড করে যাতে একটি TLVReader অবজেক্ট থেকে নেওয়া সদস্য উপাদানগুলির একটি সেট থাকে। যখন পদ্ধতিটি কল করা হয়, সরবরাহকৃত পাঠক বস্তুটি একটি TLV কন্টেইনার উপাদানে অবস্থান করা হবে বলে আশা করা হয়। নতুন এনকোড করা কন্টেইনারে ইনপুট কন্টেইনারের মতো একই ধরনের এবং সদস্য থাকবে। নতুন ধারকটির জন্য ট্যাগটি একটি ইনপুট পরামিতি হিসাবে নির্দিষ্ট করা হয়েছে৷

যখন পদ্ধতিটি ফিরে আসে, তখন লেখক বস্তুটি ধারক উপাদান অনুসরণ করে অতিরিক্ত TLV উপাদান লিখতে ব্যবহার করা যেতে পারে।

বিস্তারিত
পরামিতি
[in] tag
কন্টেইনারের সাথে এনকোড করা TLV ট্যাগ, অথবা AnonymousTag যদি ধারকটিকে ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] container
একটি TLVReader অবজেক্টের একটি রেফারেন্স যা একটি প্রাক-এনকোড করা TLV কন্টেইনার সনাক্ত করে যার ধরন এবং সদস্যদের অনুলিপি করা উচিত।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_INCORRECT_STATE
যদি সরবরাহকৃত পাঠক একটি ধারক উপাদানে অবস্থান না করে থাকে।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_TLV_UNDERRUN
যদি সরবরাহকৃত পাঠকের সাথে যুক্ত অন্তর্নিহিত TLV এনকোডিং অকালে শেষ হয়ে যায়।
WEAVE_ERROR_INVALID_TLV_ELEMENT
যদি সরবরাহ করা পাঠক একটি অবৈধ বা অসমর্থিত TLV উপাদান প্রকারের সম্মুখীন হয়।
WEAVE_ERROR_INVALID_TLV_TAG
যদি সরবরাহ করা পাঠক একটি অবৈধ প্রসঙ্গে একটি TLV ট্যাগের সম্মুখীন হয়, অথবা যদি সরবরাহকৃত ট্যাগটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে নতুন ধারকটি লেখা হচ্ছে৷
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন, অথবা রিডার অবজেক্টের সাথে যুক্ত GetNextBuffer() ফাংশন দ্বারা ফেরত অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটি।

কপি কন্টেইনার

WEAVE_ERROR CopyContainer(
  uint64_t tag,
  const uint8_t *encodedContainer,
  uint16_t encodedContainerLen
)

একটি TLV কন্টেইনার উপাদান এনকোড করে যাতে একটি প্রাক-এনকোডেড কন্টেইনার থেকে সদস্য উপাদান থাকে।

CopyContainer() পদ্ধতিটি একটি নতুন TLV কন্টেইনার উপাদান (একটি কাঠামো, অ্যারে বা পাথ) এনকোড করে যাতে একটি সরবরাহকৃত প্রাক-এনকোড করা কন্টেইনারের বিষয়বস্তু থেকে নেওয়া সদস্য উপাদানগুলির একটি সেট থাকে। যখন পদ্ধতিটি কল করা হয়, সরবরাহকৃত ইনপুট বাফারের ডেটা একটি TLV কন্টেইনার উপাদান হিসাবে পার্স করা হয় এবং একটি নতুন ধারক লেখা হয় যাতে ইনপুট ধারক হিসাবে একই প্রকার এবং সদস্য থাকে। নতুন ধারকটির জন্য ট্যাগটি একটি ইনপুট পরামিতি হিসাবে নির্দিষ্ট করা হয়েছে৷

যখন পদ্ধতিটি ফিরে আসে, তখন লেখক বস্তুটি ধারক উপাদান অনুসরণ করে অতিরিক্ত TLV উপাদান লিখতে ব্যবহার করা যেতে পারে।

বিস্তারিত
পরামিতি
[in] tag
কন্টেইনারের সাথে এনকোড করা TLV ট্যাগ, অথবা AnonymousTag যদি ধারকটিকে ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] encodedContainer
একটি প্রাক-এনকোড করা TLV কন্টেনার ধারণকারী একটি বাফার যার ধরন এবং সদস্যদের অনুলিপি করা উচিত।
[in] encodedContainerLen
প্রাক-এনকোড করা পাত্রের বাইটে দৈর্ঘ্য।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_TLV_UNDERRUN
যদি এনকোড করা ধারকটি সময়ের আগেই শেষ হয়ে যায়।
WEAVE_ERROR_INVALID_TLV_ELEMENT
যদি এনকোড করা ধারকটিতে একটি অবৈধ বা অসমর্থিত TLV উপাদানের ধরন থাকে।
WEAVE_ERROR_INVALID_TLV_TAG
যদি এনকোড করা ধারকটিতে একটি অবৈধ প্রসঙ্গে একটি TLV ট্যাগ থাকে, অথবা যদি সরবরাহকৃত ট্যাগটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে নতুন ধারকটি লেখা হচ্ছে৷
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন, অথবা রিডার অবজেক্টের সাথে যুক্ত GetNextBuffer() ফাংশন দ্বারা ফেরত অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটি।

কপি এলিমেন্ট

WEAVE_ERROR CopyElement(
  TLVReader & reader
)

পাঠক বস্তু থেকে লেখকের মধ্যে একটি TLV উপাদান কপি করে।

CopyElement() পদ্ধতিটি একটি নতুন TLV উপাদানকে এনকোড করে যার প্রকার, ট্যাগ এবং মান একটি TLVReader অবজেক্ট থেকে নেওয়া হয়। যখন পদ্ধতিটি কল করা হয়, সরবরাহকৃত পাঠক বস্তুটি উৎস TLV উপাদানে অবস্থান করা হবে বলে আশা করা হয়। নতুন এনকোড করা উপাদানটিতে ইনপুট কন্টেইনারের মতো একই প্রকার, ট্যাগ এবং বিষয়বস্তু থাকবে। যদি সরবরাহ করা উপাদানটি একটি TLV কন্টেইনার (কাঠামো, অ্যারে বা পথ) হয়, তাহলে ধারকটির সম্পূর্ণ বিষয়বস্তু অনুলিপি করা হবে।

বিস্তারিত
পরামিতি
[in] reader
একটি প্রাক-এনকোড করা TLV উপাদান সনাক্তকারী একটি TLVReader অবজেক্টের একটি রেফারেন্স যা অনুলিপি করা উচিত।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_INCORRECT_STATE
যদি সরবরাহকৃত পাঠক একটি উপাদানের উপর অবস্থান না করে থাকে।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_TLV_UNDERRUN
যদি সরবরাহকৃত পাঠকের সাথে যুক্ত অন্তর্নিহিত TLV এনকোডিং অকালে শেষ হয়ে যায়।
WEAVE_ERROR_INVALID_TLV_ELEMENT
যদি সরবরাহ করা পাঠক একটি অবৈধ বা অসমর্থিত TLV উপাদান প্রকারের সম্মুখীন হয়।
WEAVE_ERROR_INVALID_TLV_TAG
যদি সরবরাহ করা পাঠক একটি অবৈধ প্রসঙ্গে একটি TLV ট্যাগের সম্মুখীন হয়, অথবা যদি সরবরাহকৃত ট্যাগটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে নতুন ধারকটি লেখা হচ্ছে৷
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন, অথবা রিডার অবজেক্টের সাথে যুক্ত GetNextBuffer() ফাংশন দ্বারা ফেরত অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটি।

কপি এলিমেন্ট

WEAVE_ERROR CopyElement(
  uint64_t tag,
  TLVReader & reader
)

শেষ কন্টেইনার

WEAVE_ERROR EndContainer(
  TLVType outerContainerType
)

একটি TLV কন্টেইনার উপাদানের এনকোডিং সম্পূর্ণ করে।

EndContainer() পদ্ধতিটি একটি TLV কন্টেইনার উপাদানের এনকোডিং সম্পূর্ণ করে এবং StartContainer() এ পূর্বে কল করার পরে একটি TLVWrite অবজেক্টের অবস্থা পুনরুদ্ধার করে। StartContainer() অ্যাপ্লিকেশানগুলিতে প্রতিটি কলের জন্য অবশ্যই EndContainer()-এ একটি সংশ্লিষ্ট কল করতে হবে, StartContainer () কল দ্বারা প্রত্যাবর্তিত TLVType মান পাস করে। যখন EndContainer() ফিরে আসে, লেখক অবজেক্টটি অতিরিক্ত TLV উপাদান লিখতে ব্যবহার করা যেতে পারে যা কন্টেইনার উপাদান অনুসরণ করে।

বিস্তারিত
পরামিতি
[in] outerContainerType
TLVType মান যা StartContainer() পদ্ধতি দ্বারা ফেরত দেওয়া হয়েছিল।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_INCORRECT_STATE
যদি একটি সংশ্লিষ্ট StartContainer() কল করা না হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

চূড়ান্ত করা

WEAVE_ERROR Finalize(
  void
)

একটি TLV এনকোডিং লেখা শেষ করুন।

Finalize() পদ্ধতি অন্তর্নিহিত আউটপুট বাফারে একটি TLV এনকোডিং লেখার প্রক্রিয়া সম্পন্ন করে। পদ্ধতিটি বাফারের বিষয়বস্তু ব্যবহার করার আগে অ্যাপ্লিকেশন দ্বারা কল করা আবশ্যক। Finalize() শুধুমাত্র তখনই কল করা যাবে যখন বর্তমান লেখকের জন্য কোন কন্টেইনার রাইটার খোলা থাকবে না। (দেখুন OpenContainer() )।

বিস্তারিত
রিটার্ন মান
WEAVE_NO_ERROR
যদি এনকোডিং সফলভাবে চূড়ান্ত করা হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটি কনফিগার করা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তিত হয়।

GetContainerType

TLVType GetContainerType(
  void
) const 

TLVWriter বর্তমানে যে পাত্রে লিখছে তার ধরন প্রদান করে।

GetContainerType() পদ্ধতি TLV কন্টেইনারের ধরন প্রদান করে যার মধ্যে TLVWriter বর্তমানে লিখছে। যদি TLVWriter একটি পাত্রের মধ্যে উপাদানগুলি না লিখছে (যেমন যদি একটি এনকোডিংয়ের বাইরের-সবচেয়ে স্তরে লেখা হয়) পদ্ধতিটি kTLVType_NotSpecified প্রদান করে।

বিস্তারিত
রিটার্নস
বর্তমান কন্টেইনারের TLVType, অথবা kTLVType_NotSpecified যদি TLVWriter একটি কন্টেইনারের মধ্যে উপাদান না লিখে।

GetLengthWritten

uint32_t GetLengthWritten(
  void
)

লেখক শুরু হওয়ার পর থেকে লেখা মোট বাইট সংখ্যা প্রদান করে।

বিস্তারিত
রিটার্নস
লেখক শুরু হওয়ার পর থেকে লেখা মোট বাইট সংখ্যা।

এটা

void Init(
  uint8_t *buf,
  uint32_t maxLen
)

একটি একক আউটপুট বাফারে লিখতে একটি TLVWriter অবজেক্ট শুরু করে।

বিস্তারিত
পরামিতি
[in] buf
বাফারের একটি পয়েন্টার যেখানে TLV লেখা উচিত।
[in] maxLen
আউটপুট বাফারে সর্বাধিক সংখ্যক বাইট লিখতে হবে।

এটা

void Init(
  PacketBuffer *buf,
  uint32_t maxLen
)

একটি একক প্যাকেটবাফারে লিখতে একটি TLVWriter অবজেক্ট শুরু করে।

সরবরাহকৃত বাফারে বিদ্যমান ডেটার শেষ বাইটের পরপরই লেখা শুরু হয়।

বিস্তারিত
পরামিতি
[in] buf
একটি প্যাকেটবাফারের একটি পয়েন্টার যাতে TLV লেখা উচিত।
[in] maxLen
আউটপুট বাফারে সর্বাধিক সংখ্যক বাইট লিখতে হবে।

এটা

void Init(
  PacketBuffer *buf,
  uint32_t maxLen,
  bool allowDiscontiguousBuffers
)

এক বা একাধিক প্যাকেটবাফারে লিখতে একটি TLVWriter অবজেক্ট শুরু করে।

নির্দিষ্ট বাফারে বিদ্যমান ডেটার শেষ বাইটের পরপরই লেখা শুরু হয়। যদি allowDiscontiguousBuffers সত্য হয় তবে অতিরিক্ত প্যাকেটবাফারগুলি বরাদ্দ করা হবে এবং সরবরাহ করা বাফারে শৃঙ্খলাবদ্ধ করা হবে যাতে লেখা ডেটার পরিমাণ মিটমাট করা যায়। যদি নির্দিষ্ট আউটপুট বাফারটি ইতিমধ্যেই বাফারগুলির একটি চেইনের প্রধান হয়, তবে নতুন বাফারগুলি বরাদ্দ করার আগে আউটপুটটি চেইনের পরবর্তী বাফারগুলিতে লেখা হবে।

বিস্তারিত
পরামিতি
[in] buf
একটি প্যাকেটবাফারের একটি পয়েন্টার যেখানে TLV ডেটা লেখা উচিত।
[in] maxLen
আউটপুট বাফার(গুলি) এ লিখতে হবে সর্বোচ্চ সংখ্যক বাইট।
[in] allowDiscontiguousBuffers
সত্য হলে, PacketBuffers-এর একটি চেইনে ডেটা লিখুন, লিখিত ডেটা সংরক্ষণ করার জন্য প্রয়োজনীয় নতুন বাফার বরাদ্দ করুন। যদি মিথ্যা হয়, লিখিত ডেটা প্রাথমিক আউটপুট বাফারে উপলব্ধ স্থান অতিক্রম করলে WEAVE_ERROR_BUFFER_TOO_SMALL এর সাথে লেখা ব্যর্থ হবে৷

InitMalloced

void InitMalloced(
  uint8_t *& outBuf,
  uint32_t initialBufSize,
  uint32_t maxLen
)

ডায়নামিক বাফারে লিখতে একটি TLVWriter অবজেক্ট শুরু করে।

বিস্তারিত
পরামিতি
[in] buf
একটি পয়েন্টারের একটি রেফারেন্স যা বরাদ্দকৃত বাফারটি পাবে।
[in] maxLen
আউটপুট বাফারে সর্বাধিক সংখ্যক বাইট লিখতে হবে।
[in] initialBufSize
বাইটের প্রাথমিক সংখ্যা যা বাফারে বরাদ্দ করা উচিত।

ওপেন কনটেইনার

WEAVE_ERROR OpenContainer(
  uint64_t tag,
  TLVType containerType,
  TLVWriter & containerWriter
)

একটি TLV কন্টেইনার উপাদানের সদস্যদের লেখার জন্য একটি নতুন TLVWriter অবজেক্ট শুরু করে।

OpenContainer() পদ্ধতিটি একটি এনকোডিং-এ TLV কন্টেইনার উপাদান (কাঠামো, অ্যারে বা পাথ) লিখতে ব্যবহৃত হয়। পদ্ধতিটি নতুন ধারকটির ধরন এবং ট্যাগ (যদি থাকে) নেয় এবং একটি নতুন লেখক বস্তুর একটি রেফারেন্স ( কন্টেইনার লেখক ) যা কন্টেইনারের উপাদানগুলি লেখার উদ্দেশ্যে আরম্ভ করা হবে। অ্যাপ্লিকেশানগুলি কন্টেইনার রাইটার ব্যবহার করে নতুন কন্টেইনারের সদস্যদের লেখে এবং তারপর কন্টেইনার এনকোডিং সম্পূর্ণ করতে CloseContainer() এ কল করে।

কন্টেইনার লেখক খোলা থাকাকালীন, অ্যাপ্লিকেশনগুলিকে কল করা বা অন্যথায় মূল লেখকের অবস্থা পরিবর্তন করা উচিত নয়।

ধারক লেখক মূল লেখকের কাছ থেকে বিভিন্ন কনফিগারেশন বৈশিষ্ট্য উত্তরাধিকার সূত্রে প্রাপ্ত। এইগুলো:

  • অন্তর্নিহিত প্রোফাইল আইডি (ImplicitProfileId)
  • অ্যাপ্লিকেশন ডেটা পয়েন্টার (AppData)
  • GetNewBuffer এবং FinalizeBuffer ফাংশন পয়েন্টার

বিস্তারিত
পরামিতি
[in] tag
কন্টেইনারের সাথে এনকোড করা TLV ট্যাগ, অথবা AnonymousTag যদি ধারকটিকে ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] containerType
এনকোড করার জন্য কন্টেইনারের ধরন। kTLVType_Structure , kTLVType_Array বা kTLVType_Path এর একটি হতে হবে।
[out] containerWriter
একটি TLVWriter অবজেক্টের একটি রেফারেন্স যা নতুন কন্টেইনার উপাদানের সদস্যদের লেখার জন্য আরম্ভ করা হবে। সরবরাহকৃত বস্তুর সাথে যুক্ত কোনো তথ্য ওভাররাইট করা হয়।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_WRONG_TLV_TYPE
কন্টেইনার টাইপের জন্য নির্দিষ্ট করা মান ভুল হলে।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_INVALID_TLV_TAG
যদি নির্দিষ্ট ট্যাগ মানটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে মানটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  int8_t v
)

একটি TLV স্বাক্ষরিত পূর্ণসংখ্যা মান এনকোড করে।

এটি একটি ওভারলোড সদস্য ফাংশন, সুবিধার জন্য প্রদান করা হয়. এটি উপরের ফাংশন থেকে শুধুমাত্র কোন আর্গুমেন্ট (গুলি) গ্রহণ করে তা থেকে আলাদা।

বিস্তারিত
পরামিতি
[in] tag
TLV ট্যাগটি মানের সাথে এনকোড করা হবে, অথবা AnonymousTag যদি মানটি ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] v
এনকোড করা মান।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_INVALID_TLV_TAG
যদি নির্দিষ্ট ট্যাগ মানটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে মানটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  int8_t v,
  bool preserveSize
)

একটি TLV স্বাক্ষরিত পূর্ণসংখ্যা মান এনকোড করে।

এটি একটি ওভারলোড সদস্য ফাংশন, সুবিধার জন্য প্রদান করা হয়. এটি উপরের ফাংশন থেকে শুধুমাত্র কোন আর্গুমেন্ট (গুলি) গ্রহণ করে তা থেকে আলাদা।

বিস্তারিত
পরামিতি
[in] tag
TLV ট্যাগটি মানের সাথে এনকোড করা হবে, অথবা AnonymousTag যদি মানটি ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] v
এনকোড করা মান।
[in] preserveSize
সত্য যদি ইনপুট টাইপের মত একই সংখ্যক বাইটে মানটি এনকোড করা হয়। মানটি উপস্থাপন করার জন্য প্রয়োজনীয় ন্যূনতম সংখ্যক বাইটে মানটি এনকোড করা উচিত হলে মিথ্যা। দ্রষ্টব্য: এই প্যারামিটারটিকে মিথ্যাতে সেট করার জন্য অ্যাপ্লিকেশনগুলিকে দৃঢ়ভাবে উত্সাহিত করা হয়।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_INVALID_TLV_TAG
যদি নির্দিষ্ট ট্যাগ মানটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে মানটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  int16_t v
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  int16_t v,
  bool preserveSize
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  int32_t v
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  int32_t v,
  bool preserveSize
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  int64_t v
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  int64_t v,
  bool preserveSize
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  uint8_t v
)

একটি TLV স্বাক্ষরবিহীন পূর্ণসংখ্যা মান এনকোড করে।

এটি একটি ওভারলোড সদস্য ফাংশন, সুবিধার জন্য প্রদান করা হয়. এটি উপরের ফাংশন থেকে শুধুমাত্র কোন আর্গুমেন্ট (গুলি) গ্রহণ করে তা থেকে আলাদা।

বিস্তারিত
পরামিতি
[in] tag
TLV ট্যাগটি মানের সাথে এনকোড করা হবে, অথবা AnonymousTag যদি মানটি ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] v
এনকোড করা মান।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_INVALID_TLV_TAG
যদি নির্দিষ্ট ট্যাগ মানটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে মানটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  uint8_t v,
  bool preserveSize
)

একটি TLV স্বাক্ষরবিহীন পূর্ণসংখ্যা মান এনকোড করে।

এটি একটি ওভারলোড সদস্য ফাংশন, সুবিধার জন্য প্রদান করা হয়. এটি উপরের ফাংশন থেকে শুধুমাত্র কোন আর্গুমেন্ট (গুলি) গ্রহণ করে তা থেকে আলাদা।

বিস্তারিত
পরামিতি
[in] tag
TLV ট্যাগটি মানের সাথে এনকোড করা হবে, অথবা AnonymousTag যদি মানটি ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] v
এনকোড করা মান।
[in] preserveSize
সত্য যদি ইনপুট টাইপের মত একই সংখ্যক বাইটে মানটি এনকোড করা হয়। মানটি উপস্থাপন করার জন্য প্রয়োজনীয় ন্যূনতম সংখ্যক বাইটে মানটি এনকোড করা উচিত হলে মিথ্যা। দ্রষ্টব্য: এই প্যারামিটারটিকে মিথ্যাতে সেট করার জন্য অ্যাপ্লিকেশনগুলিকে দৃঢ়ভাবে উত্সাহিত করা হয়।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_INVALID_TLV_TAG
যদি নির্দিষ্ট ট্যাগ মানটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে মানটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  uint16_t v
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  uint16_t v,
  bool preserveSize
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  uint32_t v
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  uint32_t v,
  bool preserveSize
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  uint64_t v
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  uint64_t v,
  bool preserveSize
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  float v
)

রাখুন

WEAVE_ERROR Put(
  uint64_t tag,
  double v
)

একটি TLV ফ্লোটিং পয়েন্ট মান এনকোড করে।

এটি একটি ওভারলোড সদস্য ফাংশন, সুবিধার জন্য প্রদান করা হয়. এটি উপরের ফাংশন থেকে শুধুমাত্র কোন আর্গুমেন্ট (গুলি) গ্রহণ করে তা থেকে আলাদা।

বিস্তারিত
পরামিতি
[in] tag
TLV ট্যাগটি মানের সাথে এনকোড করা হবে, অথবা AnonymousTag যদি মানটি ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] v
এনকোড করা মান।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_INVALID_TLV_TAG
যদি নির্দিষ্ট ট্যাগ মানটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে মানটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

পুটবুলিয়ান

WEAVE_ERROR PutBoolean(
  uint64_t tag,
  bool v
)

একটি TLV বুলিয়ান মান এনকোড করে।

বিস্তারিত
পরামিতি
[in] tag
TLV ট্যাগটি মানের সাথে এনকোড করা হবে, অথবা AnonymousTag যদি মানটি ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] v
এনকোড করা মান।
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_INVALID_TLV_TAG
যদি নির্দিষ্ট ট্যাগ মানটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে মানটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
অন্যান্য ওয়েভ বা প্ল্যাটফর্ম-নির্দিষ্ট ত্রুটিগুলি কনফিগার করা GetNewBuffer() বা FinalizeBuffer() ফাংশন দ্বারা প্রত্যাবর্তন করা হয়েছে৷

পুটবাইটস

WEAVE_ERROR PutBytes(
  uint64_t tag,
  const uint8_t *buf,
  uint32_t len
)

একটি TLV বাইট স্ট্রিং মান এনকোড করে।

বিস্তারিত
পরামিতি
[in] tag
TLV ট্যাগটি মানের সাথে এনকোড করা হবে, অথবা AnonymousTag যদি মানটি ট্যাগ ছাড়াই এনকোড করা উচিত। ট্যাগের মানগুলি একটি ট্যাগ সংজ্ঞা ফাংশন ProfileTag() , ContextTag() বা CommonTag() দিয়ে তৈরি করা উচিত।
[in] buf
এনকোড করা বাইট স্ট্রিং ধারণকারী একটি বাফার একটি পয়েন্টার.
[in] len
এনকোড করা বাইট সংখ্যা.
রিটার্ন মান
WEAVE_NO_ERROR
যদি পদ্ধতি সফল হয়।
WEAVE_ERROR_TLV_CONTAINER_OPEN
যদি বর্তমান লেখকের উপর একটি ধারক লেখক খোলা হয়েছে এবং এখনও বন্ধ করা হয়নি।
WEAVE_ERROR_INVALID_TLV_TAG
যদি নির্দিষ্ট ট্যাগ মানটি অবৈধ বা অনুপযুক্ত হয় যে প্রসঙ্গে মানটি লেখা হচ্ছে।
WEAVE_ERROR_BUFFER_TOO_SMALL
যদি লেখার মানটি লেখকের আরম্ভ করার সময় নির্দিষ্ট করা বাইটগুলির সর্বোচ্চ সংখ্যার সীমা অতিক্রম করে।
WEAVE_ERROR_NO_MEMORY
যদি মেমরির অভাবের কারণে একটি আউটপুট বাফার বরাদ্দ করার প্রচেষ্টা ব্যর্থ হয়।
other
Other Weave or platform-specific errors returned by the configured GetNewBuffer() or FinalizeBuffer() functions.

PutNull

WEAVE_ERROR PutNull(
  uint64_t tag
)

Encodes a TLV null value.

বিস্তারিত
পরামিতি
[in] tag
The TLV tag to be encoded with the value, or AnonymousTag if the value should be encoded without a tag. Tag values should be constructed with one of the tag definition functions ProfileTag() , ContextTag() or CommonTag() .
রিটার্ন মান
WEAVE_NO_ERROR
If the method succeeded.
WEAVE_ERROR_TLV_CONTAINER_OPEN
If a container writer has been opened on the current writer and not yet closed.
WEAVE_ERROR_INVALID_TLV_TAG
If the specified tag value is invalid or inappropriate in the context in which the value is being written.
WEAVE_ERROR_BUFFER_TOO_SMALL
If writing the value would exceed the limit on the maximum number of bytes specified when the writer was initialized.
WEAVE_ERROR_NO_MEMORY
If an attempt to allocate an output buffer failed due to lack of memory.
other
Other Weave or platform-specific errors returned by the configured GetNewBuffer() or FinalizeBuffer() functions.

PutPreEncodedContainer

WEAVE_ERROR PutPreEncodedContainer(
  uint64_t tag,
  TLVType containerType,
  const uint8_t *data,
  uint32_t dataLen
)

Encodes a TLV container element from a pre-encoded set of member elements.

The PutPreEncodedContainer() method encodes a new TLV container element (a structure, array or path) containing a set of member elements taken from a pre-encoded buffer. The input buffer is expected to contain zero or more full-encoded TLV elements, with tags that conform to the rules associated with the specified container type (eg structure members must have tags, while array members must not).

The method encodes the entirety of the container element in one call. When PutPreEncodedContainer() returns, the writer object can be used to write additional TLV elements following the container element.

বিস্তারিত
পরামিতি
[in] tag
The TLV tag to be encoded with the container, or AnonymousTag if the container should be encoded without a tag. Tag values should be constructed with one of the tag definition functions ProfileTag() , ContextTag() or CommonTag() .
[in] containerType
The type of container to encode. Must be one of kTLVType_Structure , kTLVType_Array or kTLVType_Path .
[in] data
A pointer to a buffer containing zero of more encoded TLV elements that will become the members of the new container.
[in] dataLen
The number of bytes in the data buffer.
রিটার্ন মান
WEAVE_NO_ERROR
If the method succeeded.
WEAVE_ERROR_WRONG_TLV_TYPE
If the value specified for containerType is incorrect.
WEAVE_ERROR_TLV_CONTAINER_OPEN
If a container writer has been opened on the current writer and not yet closed.
WEAVE_ERROR_INVALID_TLV_TAG
If the specified tag value is invalid or inappropriate in the context in which the value is being written.
WEAVE_ERROR_BUFFER_TOO_SMALL
If writing the value would exceed the limit on the maximum number of bytes specified when the writer was initialized.
WEAVE_ERROR_NO_MEMORY
If an attempt to allocate an output buffer failed due to lack of memory.
other
Other Weave or platform-specific errors returned by the configured GetNewBuffer() or FinalizeBuffer() functions.

PutString

WEAVE_ERROR PutString(
  uint64_t tag,
  const char *buf
)

Encodes a TLV UTF8 string value.

বিস্তারিত
পরামিতি
[in] tag
The TLV tag to be encoded with the value, or AnonymousTag if the value should be encoded without a tag. Tag values should be constructed with one of the tag definition functions ProfileTag() , ContextTag() or CommonTag() .
[in] buf
A pointer to the null-terminated UTF-8 string to be encoded.
রিটার্ন মান
WEAVE_NO_ERROR
If the method succeeded.
WEAVE_ERROR_TLV_CONTAINER_OPEN
If a container writer has been opened on the current writer and not yet closed.
WEAVE_ERROR_INVALID_TLV_TAG
If the specified tag value is invalid or inappropriate in the context in which the value is being written.
WEAVE_ERROR_BUFFER_TOO_SMALL
If writing the value would exceed the limit on the maximum number of bytes specified when the writer was initialized.
WEAVE_ERROR_NO_MEMORY
If an attempt to allocate an output buffer failed due to lack of memory.
other
Other Weave or platform-specific errors returned by the configured GetNewBuffer() or FinalizeBuffer() functions.

PutString

WEAVE_ERROR PutString(
  uint64_t tag,
  const char *buf,
  uint32_t len
)

Encodes a TLV UTF8 string value.

বিস্তারিত
পরামিতি
[in] tag
The TLV tag to be encoded with the value, or AnonymousTag if the value should be encoded without a tag. Tag values should be constructed with one of the tag definition functions ProfileTag() , ContextTag() or CommonTag() .
[in] buf
A pointer to the UTF-8 string to be encoded.
[in] len
The length (in bytes) of the string to be encoded.
রিটার্ন মান
WEAVE_NO_ERROR
If the method succeeded.
WEAVE_ERROR_TLV_CONTAINER_OPEN
If a container writer has been opened on the current writer and not yet closed.
WEAVE_ERROR_INVALID_TLV_TAG
If the specified tag value is invalid or inappropriate in the context in which the value is being written.
WEAVE_ERROR_BUFFER_TOO_SMALL
If writing the value would exceed the limit on the maximum number of bytes specified when the writer was initialized.
WEAVE_ERROR_NO_MEMORY
If an attempt to allocate an output buffer failed due to lack of memory.
other
Other Weave or platform-specific errors returned by the configured GetNewBuffer() or FinalizeBuffer() functions.

PutStringF

WEAVE_ERROR PutStringF(
  uint64_t tag,
  const char *fmt,
  ...
)

Encode the string output formatted according to the format in the TLV element.

PutStringF is an analog of a sprintf where the output is stored in a TLV element as opposed to a character buffer. When extended printf functionality is available, the function is able to output the result string into a discontinuous underlying storage. The implementation supports the following printf enhancements:

The platform supplies a callback-based vcbprintf that provides the ability to call a custom callback in place of putchar.

The platform supplies a variant of vsnprintf called vsnprintf_ex , that behaves exactly like vsnprintf except it has provisions for omitting the first n characters of the output.

Note that while the callback-based function may be the simplest and use the least amount of code, the vsprintf_ex variety of functions will consume less stack.

If neither of the above is available, but platform provides malloc the function will allocate a temporary buffer to hold the output. When the platform supplies neither enhancement to the printf family nor malloc, the output is truncated such that it fits in the continuous state in the current TLV storage

বিস্তারিত
পরামিতি
[in] tag
The TLV tag to be encoded with the value, or AnonymousTag if the value should be encoded without a tag. Tag values should be constructed with one of the tag definition functions ProfileTag() , ContextTag() or CommonTag() .
[in] fmt
The format string used to format the argument list. Follows the same syntax and rules as the format string for printf family of functions.
[in] ...
A list of arguments to be formatted in the output value according to fmt.
রিটার্ন মান
WEAVE_NO_ERROR
If the method succeeded.
other
If underlying calls to TLVWriter methods WriteElementHead or GetNewBuffer failed, their error is immediately forwarded up the call stack.

StartContainer

WEAVE_ERROR StartContainer(
  uint64_t tag,
  TLVType containerType,
  TLVType & outerContainerType
)

Begins encoding a new TLV container element.

The StartContainer() method is used to write TLV container elements (structure, arrays or paths) to an encoding. The method takes the type and tag (if any) of the new container, and a reference to a TLVType value which will be used to save the current context of the writer while it is being used to write the container.

Once the StartContainer() method returns, the application should use the current TLVWriter object to write the elements of the container. When finish, the application must call the EndContainer() method to finish the encoding of the container.

বিস্তারিত
পরামিতি
[in] tag
The TLV tag to be encoded with the container, or AnonymousTag if the container should be encoded without a tag. Tag values should be constructed with one of the tag definition functions ProfileTag() , ContextTag() or CommonTag() .
[in] containerType
The type of container to encode. Must be one of kTLVType_Structure , kTLVType_Array or kTLVType_Path .
[out] outerContainerType
A reference to a TLVType value that will receive the context of the writer.
রিটার্ন মান
WEAVE_NO_ERROR
If the method succeeded.
WEAVE_ERROR_WRONG_TLV_TYPE
If the value specified for containerType is incorrect.
WEAVE_ERROR_TLV_CONTAINER_OPEN
If a container writer has been opened on the current writer and not yet closed.
WEAVE_ERROR_INVALID_TLV_TAG
If the specified tag value is invalid or inappropriate in the context in which the value is being written.
WEAVE_ERROR_BUFFER_TOO_SMALL
If writing the value would exceed the limit on the maximum number of bytes specified when the writer was initialized.
WEAVE_ERROR_NO_MEMORY
If an attempt to allocate an output buffer failed due to lack of memory.
other
Other Weave or platform-specific errors returned by the configured GetNewBuffer() or FinalizeBuffer() functions.

StartPutBytes

WEAVE_ERROR StartPutBytes(
  uint64_t tag,
  uint32_t totalLen
)

Encodes a TLV byte string in multiple chunks.

This should be used with ContinuePutBytes.

বিস্তারিত
পরামিতি
[in] tag
The TLV tag to be encoded with the value, or AnonymousTag if the value should be encoded without a tag. Tag values should be constructed with one of the tag definition functions ProfileTag() , ContextTag() or CommonTag() .
[in] totalLen
The total number of bytes to be encoded.
রিটার্ন মান
WEAVE_NO_ERROR
If the method succeeded.
WEAVE_ERROR_TLV_CONTAINER_OPEN
If a container writer has been opened on the current writer and not yet closed.
WEAVE_ERROR_INVALID_TLV_TAG
If the specified tag value is invalid or inappropriate in the context in which the value is being written.
WEAVE_ERROR_BUFFER_TOO_SMALL
If writing the value would exceed the limit on the maximum number of bytes specified when the writer was initialized.
WEAVE_ERROR_NO_MEMORY
If an attempt to allocate an output buffer failed due to lack of memory.
other
Other Weave or platform-specific errors returned by the configured GetNewBuffer() or FinalizeBuffer() functions.

VPutStringF

WEAVE_ERROR VPutStringF(
  uint64_t tag,
  const char *fmt,
  va_list ap
)

Encode the string output formatted according to the format in the TLV element.

PutStringF is an analog of a sprintf where the output is stored in a TLV element as opposed to a character buffer. When extended printf functionality is available, the function is able to output the result string into a discontinuous underlying storage. The implementation supports the following printf enhancements:

The platform supplies a callback-based vcbprintf that provides the ability to call a custom callback in place of putchar.

The platform supplies a variant of vsnprintf called vsnprintf_ex , that behaves exactly like vsnprintf except it has provisions for omitting the first n characters of the output.

Note that while the callback-based function may be the simplest and use the least amount of code, the vsprintf_ex variety of functions will consume less stack.

If neither of the above is available, but platform provides malloc the function will allocate a temporary buffer to hold the output. When the platform supplies neither enhancement to the printf family nor malloc, the output is truncated such that it fits in the continuous state in the current TLV storage

বিস্তারিত
পরামিতি
[in] tag
The TLV tag to be encoded with the value, or AnonymousTag if the value should be encoded without a tag. Tag values should be constructed with one of the tag definition functions ProfileTag() , ContextTag() or CommonTag() .
[in] fmt
The format string used to format the argument list. Follows the same syntax and rules as the format string for printf family of functions.
[in] ap
A list of arguments to be formatted in the output value according to fmt.
রিটার্ন মান
WEAVE_NO_ERROR
If the method succeeded.
other
If underlying calls to TLVWriter methods WriteElementHead or GetNewBuffer failed, their error is immediately forwarded up the call stack.

পাবলিক স্ট্যাটিক ফাংশন

FinalizePacketBuffer

WEAVE_ERROR FinalizePacketBuffer(
  TLVWriter & writer,
  uintptr_t bufHandle,
  uint8_t *bufStart,
  uint32_t dataLen
)

An implementation of a TLVWriter FinalizeBuffer function for writing to a chain of PacketBuffers.

The FinalizePacketBuffer() function performs the necessary finalization required when using a TLVWriter to write to a chain of PacketBuffers. The function is designed to be used in conjunction with the GetNewPacketBuffer() function.

See the FinalizeBufferFunct type definition for additional information on the API of the FinalizePacketBuffer() function.

GetNewBuffer_Malloced

WEAVE_ERROR GetNewBuffer_Malloced(
  TLVWriter & writer,
  uintptr_t & bufHandle,
  uint8_t *& bufStart,
  uint32_t & bufLen
)

An implementation of a TLVWriter GetNewBuffer function for writing to a dynamic buffer.

The GetNewBuffer_Malloced() function supplies new output space to a TLVWriter by doubling the size of the underlying dynamic buffer as needed to store the encoding. The function is designed to be assigned to the TLVWriter GetNewBuffer function pointer.

See the GetNewBufferFunct type definition for additional information on the API of the GetNewBuffer_Malloced() function.

GetNewPacketBuffer

WEAVE_ERROR GetNewPacketBuffer(
  TLVWriter & writer,
  uintptr_t & bufHandle,
  uint8_t *& bufStart,
  uint32_t & bufLen
)

An implementation of a TLVWriter GetNewBuffer function for writing to a chain of PacketBuffers.

The GetNewPacketBuffer() function supplies new output space to a TLVWriter by allocating a chain of one or more PacketBuffers as needed to store the encoding. The function is designed to be assigned to the TLVWriter GetNewBuffer function pointer.

Note that when using the GetNewPacketBuffer with a TLVWriter , the corresponding FinalizePacketBuffer() function (or an equivalent) should also be used to finalize the buffer chain.

See the GetNewBufferFunct type definition for additional information on the API of the GetNewPacketBuffer() function.

Protected functions

IsCloseContainerReserved

bool IsCloseContainerReserved(
  void
) const 

Determine whether the container should reserve space for the CloseContainer symbol at the point of starting / opening the container.

IsContainerOpen

bool IsContainerOpen(
  void
) const 

SetCloseContainerReserved

void SetCloseContainerReserved(
  bool aCloseContainerReserved
)

Set whether the container should reserve the space for the CloseContainer symbol at the point of starting / opening the container.

SetContainerOpen

void SetContainerOpen(
  bool aContainerOpen
)

WriteData

WEAVE_ERROR WriteData(
  const uint8_t *p,
  uint32_t len
)

WriteElementHead

WEAVE_ERROR WriteElementHead(
  TLVElementType elemType,
  uint64_t tag,
  uint64_t lenOrVal
)

WriteElementWithData

WEAVE_ERROR WriteElementWithData(
  TLVType type,
  uint64_t tag,
  const uint8_t *data,
  uint32_t dataLen
)