host/stream_comm.c
/** nanopb field callback which will write the string specified by arg.
  * \param stream Output stream to write to.
  * \param field Field which contains the string.
  * \param arg Pointer to #StringSetAndSpec structure specifying the string
  *            to write.
  * \return true on success, false on failure (nanopb convention).
  */
nanopb field callback which will write the string specified by arg.
\param stream Output stream to write to.
\param field Field which contains the string.
\param arg Pointer to #StringSetAndSpec structure specifying the string
to write.
\return true on success, false on failure (nanopb convention).
nanopb field callback which will write the string specified by arg . \ param stream Output stream to write to . \ param field Field which contains the string . \ param arg Pointer to #StringSetAndSpec structure specifying the string to write . \ return true on success false on failure ( nanopb convention ) .
bool writeStringCallback(pb_ostream_t *stream, const pb_field_t *field, void * const *arg)
{
	uint16_t i;
	uint16_t length;
	char c;
	struct StringSetAndSpec **ptr_arg_s;
	struct StringSetAndSpec *arg_s;
	ptr_arg_s = (struct StringSetAndSpec **)arg;
	if (ptr_arg_s == NULL)
		fatalError(); 
	arg_s = *ptr_arg_s;
	if (arg_s == NULL)
		fatalError(); 
	length = getStringLength(arg_s->next_set, arg_s->next_spec);
	if (!pb_encode_tag_for_field(stream, field))
		return false;
	if (!pb_encode_varint(stream, (uint64_t)length))
		return false;
	for (i = 0; i < length; i++)
	{
		c = getString(arg_s->next_set, arg_s->next_spec, i);
		if (!pb_write(stream, (uint8_t *)&c, 1))
			return false;
	}
	return true;
}
bool writeStringCallback ( pb_ostream_t * stream , const pb_field_t * field , void * const * arg ) { uint16_t i ; uint16_t length ; char c ; struct StringSetAndSpec * * ptr_arg_s ; struct StringSetAndSpec * arg_s ; ptr_arg_s = ( struct StringSetAndSpec * * ) arg ; if ( ptr_arg_s == NULL ) fatalError ( ) ; arg_s = * ptr_arg_s ; if ( arg_s == NULL ) fatalError ( ) ; length = getStringLength ( arg_s -> next_set , arg_s -> next_spec ) ; if ( ! pb_encode_tag_for_field ( stream , field ) ) return false ; if ( ! pb_encode_varint ( stream , ( uint64_t ) length ) ) return false ; for ( i = 0 ; i < length ; i ++ ) { c = getString ( arg_s -> next_set , arg_s -> next_spec , i ) ; if ( ! pb_write ( stream , ( uint8_t * ) & c , 1 ) ) return false ; } return true ; }
nanopb field callback which will write the string specified by arg.
nanopb field callback which will write the string specified by arg .
/* This should never happen */ /* This should never happen */ /* Cannot use pb_encode_string() because it expects a pointer to the
	 * contents of an entire string; getString() does not return such a
	 * pointer.
	 */