[−][src]Struct mynewt::encoding::coap_context::CoapContext
CoAP encoder state. Buffers the next key and value to be encoded.
Fields
key_buffer: [u8; 32]
Static buffer for the key to be encoded. Will be passed to Mynewt COAP encoder API. Always null-terminated.
value_buffer: [u8; 32]
Static buffer for the string value to be encoded. Will be passed to Mynewt COAP encoder API. Always null-terminated.
Methods
impl CoapContext
[src]
pub fn json_set_geolocation(
&mut self,
_key: &Strn,
_lat_key: &Strn,
_long_key: &Strn,
_geo: SensorValueType
)
[src]
&mut self,
_key: &Strn,
_lat_key: &Strn,
_long_key: &Strn,
_geo: SensorValueType
)
pub fn json_set_text_string(&mut self, key: &Strn, value: &Strn)
[src]
Encode a text value into the current JSON document with the specified key
fn key_strn_to_cstr(&mut self, key: &Strn) -> *const u8
[src]
Given a Strn key key
, return a *char
pointer that is null-terminated. Used for encoding COAP keys.
If key
is null-terminated, return it as a pointer. Else copy key
to the static key buffer,
append null and return the static key buffer as a pointer.
fn value_strn_to_cstr(&mut self, value: &Strn) -> *const u8
[src]
Given a Strn value value
, return a *char
pointer that is null-terminated. Used for encoding COAP values.
If value
is null-terminated, return it as a pointer. Else copy value
to the static value buffer,
append null and return the static value buffer as a pointer.
pub fn key_to_cstr(&mut self, s: &[u8]) -> *const u8
[src]
Given a key s
, return a *char
pointer that is null-terminated. Used for encoding COAP keys.
If s
is null-terminated, return it as a pointer. Else copy s
to the static key buffer,
append null and return the static key buffer as a pointer.
pub fn value_to_cstr(&mut self, s: &[u8]) -> *const u8
[src]
Given a value s
, return a *char
pointer that is null-terminated. Used for encoding COAP values.
If s
is null-terminated, return it as a pointer. Else copy s
to the static value buffer,
append null and return the static value buffer as a pointer.
pub fn cstr_len(&self, s: &[u8]) -> usize
[src]
Compute the byte length of the string in s
.
If s
is null-terminated, return length of s
- 1. Else return length of s
.
pub fn global_encoder(&self) -> *mut CborEncoder
[src]
Return the global CBOR encoder
pub fn new_encoder(&self, key: &str, suffix: &str) -> *mut CborEncoder
[src]
Create a new CBOR encoder for the current map or array, e.g. key=root, suffix=_map
pub fn encoder(&self, key: &str, suffix: &str) -> *mut CborEncoder
[src]
Return the CBOR encoder for the current map or array, e.g. key=root, suffix=_map
pub fn check_result(&self, res: u32)
[src]
Fail the encoding with an error if res
is non-zero.
pub fn fail(&mut self, err: CoapError)
[src]
Fail the encoding with an error
pub fn to_void_ptr(&mut self) -> *mut c_void
[src]
Cast itself as a *mut c_void
Trait Implementations
impl Default for CoapContext
[src]
fn default() -> CoapContext
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,