src/Recognition.cpp
/// <summary>
/// Event called when a valid json message was received. 
/// Consumes the proper values for this sensor.
/// </summary>
/// <param name="root">The root json object.</param>
/// <param name="shieldEvent">The shield event.</param>

Event called when a valid json message was received.
Consumes the proper values for this sensor.

The root json object.
The shield event.
Event called when a valid json message was received . Consumes the proper values for this sensor . The root json object . The shield event .
void Recognition::onJsonReceived(JsonObject& root, ShieldEvent* shieldEvent)
{
	recognizedIndex = shieldEvent->resultId;
	confidence = static_cast<int>(shieldEvent->value);
	if (this->openTextBuffer)
	{
		int index = 0;
		int max = this->length[0];
		while (shieldEvent->result[index] && index < max)
		{
			this->openTextBuffer[index] = shieldEvent->result[index];
			index++;
		}
		this->length[0] = index;
	}
	Sensor::onJsonReceived(root, shieldEvent);
}
void Recognition :: onJsonReceived ( JsonObject & root , ShieldEvent * shieldEvent ) { recognizedIndex = shieldEvent -> resultId ; confidence = static_cast < int > ( shieldEvent -> value ) ; if ( this -> openTextBuffer ) { int index = 0 ; int max = this -> length [ 0 ] ; while ( shieldEvent -> result [ index ] && index < max ) { this -> openTextBuffer [ index ] = shieldEvent -> result [ index ] ; index ++ ; } this -> length [ 0 ] = index ; } Sensor :: onJsonReceived ( root , shieldEvent ) ; }
<summary>
Event called when a valid json message was received.
<summary > Event called when a valid json message was received .