Example #1
0
int main() {
	Packet *packet = createPacket();
	if (packet != NULL) {
		destroyPacket(&packet);
		handlePacket(packet);
	}
	return 0;
}
void test_gdbCreateMsgPacket_given_empty_string_should_return_a_complete_packet(void)
{
    char *packet;

    packet = gdbCreateMsgPacket("");

    TEST_ASSERT_EQUAL_STRING("$#00", packet);

    destroyPacket(packet);
}
void test_gdbCreateMsgPacket_given_string_of_data_should_return_a_complete_packet(void)
{
    char data[] = "OK";
    char *packet;

    packet = gdbCreateMsgPacket(data);

    TEST_ASSERT_EQUAL_STRING("$OK#9a", packet);

    destroyPacket(packet);
}
Example #4
0
bool Node::_cmdConfigExit( co::Command& command )
{
    LB_TS_THREAD( _nodeThread );
    LBLOG( LOG_INIT ) << "Node exit " 
                      << command.get<NodeConfigExitPacket>() << std::endl;

    const Pipes& pipes = getPipes();
    for( Pipes::const_iterator i = pipes.begin(); i != pipes.end(); ++i )
    {
        Pipe* pipe = *i;
        pipe->waitExited();
    }
    
    _state = configExit() ? STATE_STOPPED : STATE_FAILED;
    transmitter.getQueue().wakeup();
    transmitter.join();
    _flushObjects();

    ConfigDestroyNodePacket destroyPacket( getID( ));
    getConfig()->send( getLocalNode(), destroyPacket );
    return true;
}
Example #5
0
bool Window::_cmdConfigExit( co::Command& command )
{
    const WindowConfigExitPacket* packet =
        command.get<WindowConfigExitPacket>();
    LBLOG( LOG_INIT ) << "TASK window config exit " << packet << std::endl;

    if( _state != STATE_STOPPED )
    {
        if( getPipe()->isRunning( ) && _systemWindow )
        {
            makeCurrent();
            getPipe()->flushFrames( _objectManager );
        }
        // else emergency exit, no context available.

        _state = configExit() ? STATE_STOPPED : STATE_FAILED;
    }

    PipeDestroyWindowPacket destroyPacket( getID( ));
    getPipe()->send( getLocalNode(), destroyPacket );
    return true;
}
Example #6
0
void destroyQueuedPacket(QueuedPacket* packet) {
  destroyPacket(packet->packet);
  free(packet);
}