Exemplo n.º 1
0
// --------------------------------------------------------------------------
// ARDrone::close()
// Description  : Finalize
// Return value : NONE
// --------------------------------------------------------------------------
void ARDrone::close(void)
{
    // Stop AR.Drone
    if (!onGround()) landing();

    // Finalize Navdata
    finalizeNavdata();

    // Finalize configuration
    finalizeConfig();

    // Finalize AT command
    finalizeCommand();

    // Finalize video
    finalizeVideo();

    // Finalize WSA
    WSACleanup();
}
/**
 * Initializes the configuration sub-system.
 *
 * @return <tt>0</tt> for success, otherwise a non-zero value
 */
int
initializeConfig(void) {
    if (implementationProperties != NULL) {
        /* Already initialized. */
        return 0;
    }

    if (initProps(&implementationProperties, &IMPL_PROPERTY_FILE,
                  storage_get_config_root(INTERNAL_STORAGE_ID)) != 0) {
        return -1;
    }

    if (initProps(&applicationProperties, &APPL_PROPERTY_FILE,
                  storage_get_config_root(INTERNAL_STORAGE_ID)) != 0) {
        finalizeConfig();
        return -1;
    }

    /*
     * Make sure the configuration was specified, because
     * some older code requires it in the CLDC classes.
     */
    if (getSystemProperty(DEFAULT_CONFIGURATION) == NULL) {
        setSystemProperty(DEFAULT_CONFIGURATION, DEFAULT_CLDC);
    }

    if (getSystemProperty(PROFILES_PROP_NAME) == NULL) {
        setSystemProperty(PROFILES_PROP_NAME, DEFAULT_PROFILE);
    }

    if (getSystemProperty(ENCODING_PROP_NAME) == NULL) {
        setSystemProperty(ENCODING_PROP_NAME, DEFAULT_CHARACTER_ENCODING);
    }

    return 0;
}