Exemplo n.º 1
0
static void bootWiFi2() {
	ESP_LOGD(tag, ">> bootWiFi2");
	// Check for a GPIO override which occurs when a physical Pin is high
	// during the test.  This can force the ability to check for new configuration
	// even if the existing configured access point is available.
	if (checkOverrideGpio()) {
		ESP_LOGD(tag, "- GPIO override detected");
		becomeAccessPoint();
	} else {
		// There was NO GPIO override, proceed as normal.  This means we retrieve
		// our stored access point information of the access point we should connect
		// against.  If that information doesn't exist, then again we become an
		// access point ourselves in order to allow a client to connect and bring
		// up a browser.
		connection_info_t connectionInfo;
		int rc = getConnectionInfo(&connectionInfo);
		if (rc == 0) {
			// We have received connection information, let us now become a station
			// and attempt to connect to the access point.
			becomeStation(&connectionInfo);

		} else {
			// We do NOT have connection information.  Let us now become an access
			// point that serves up a web server and allow a browser user to specify
			// the details that will be eventually used to allow us to connect
			// as a station.
			becomeAccessPoint();
		} // We do NOT have connection info
	}
	ESP_LOGD(tag, "<< bootWiFi2");
} // bootWiFi2
Exemplo n.º 2
0
void P2PConnectionsWindow::removeConnectionItem(uint32 connectionID)
{
	int32 connectionItem = getConnectionItem(connectionID);
	if(connectionItem == -1)
		return;

	OS_ASSERT(getConnectionInfo(connectionID) == nullptr);
	m_connectionsCtrl->DeleteItem(connectionItem);
}
Exemplo n.º 3
0
void P2PConnectionsWindow::refreshConnectionItem(uint32 connectionID)
{
	// Carica i dettagli sulla connessione
	shared_ptr<ConnectionInfo> connectionInfo = getConnectionInfo(connectionID);
	if(connectionInfo == nullptr || connectionInfo->getModified() == false)
		return;		// Il riferimento alla connessione potrebbe essere stato rimosso in seguito al superamento del limite

	int32 connectionItem = -1;
	if(connectionInfo->getInitialized())
	{
		connectionItem = getConnectionItem(connectionID);
	}
	else
	{
		int32 iconIndex = -1;

		shared_ptr<ConnectionStatus> nodeStatus = connectionInfo->getConnectionStatus();
		OS_ASSERT(nodeStatus != nullptr);
		if(nodeStatus != nullptr)
		{
			OS_ASSERT(boost::dynamic_pointer_cast<p2p::NodeStatus>(nodeStatus) != nullptr);
			iconIndex = boost::dynamic_pointer_cast<p2p::NodeStatus>(nodeStatus)->getOutgoing() ? m_connectionOutIcon : m_connectionInIcon;
		}

		connectionItem = m_connectionsCtrl->InsertItem(m_connectionsCtrl->GetItemCount(), iconIndex);
		if(connectionItem == -1)
		{
			OS_ASSERTFALSE();
			return;
		}
		m_connectionsCtrl->SetItemData(connectionItem, connectionID);

		connectionInfo->setInitialized(true);
	}

	// Aggiorna i dettagli sulla connessione
	shared_ptr<p2p::NodeStatus> connectionStatus = boost::dynamic_pointer_cast<p2p::NodeStatus>(connectionInfo->getConnectionStatus());
	if(connectionStatus == nullptr)
	{
		OS_ASSERTFALSE();
		return;
	}

	String status;
	switch(connectionStatus->getStatus())
	{
	case p2p::NodeStatus::statusInitializing:			status = getText(_S("ui.mainframe.connections.nodestatus.initializing"));
														break;

	case p2p::NodeStatus::statusAttemptingConnection:	status = getText(_S("ui.mainframe.connections.nodestatus.attempting_connection"));
														break;

	case p2p::NodeStatus::statusHandshaking:			status = getText(_S("ui.mainframe.connections.nodestatus.handshaking"));
														break;

	case p2p::NodeStatus::statusExchanging:				status = getText(_S("ui.mainframe.connections.nodestatus.exchanging_data"));
														break;

	case p2p::NodeStatus::statusTerminating:			status = getText(_S("ui.mainframe.connections.nodestatus.terminating"));
														break;

	default:											OS_ASSERTFALSE();
														break;
	}

	m_connectionsCtrl->SetItem(connectionItem, columnStatus, conversions::from_utf16<wxString>(status));

	shared_ptr<Portal> portal = connectionStatus->getPortal();
	m_connectionsCtrl->SetItem(connectionItem, columnPortal, portal != nullptr ? conversions::from_utf16<wxString>(portal->getName()) : conversions::from_utf16<wxString>(_S("?")));

	shared_ptr<IPAddress> peer = connectionStatus->getPeer();
	m_connectionsCtrl->SetItem(connectionItem, columnPeer, (peer == nullptr || peer->isAny()) ? conversions::from_utf16<wxString>(_S("?")) : conversions::from_utf16<wxString>(String::format(_S("%S:%d").c_str(), peer->toString().c_str(), peer->getPort())));

	String tranfers = String::format(_S("D: %S / U: %S").c_str(), utils::formatSize(connectionStatus->getDownloadedBytes()).c_str(), utils::formatSize(connectionStatus->getUploadedBytes()).c_str());
	m_connectionsCtrl->SetItem(connectionItem, columnTransfers, conversions::from_utf16<wxString>(tranfers));

	String objects = String::format(_S("D: %d / U: %d").c_str(), connectionStatus->getDownloadedObjects(), connectionStatus->getUploadedObjects());
	m_connectionsCtrl->SetItem(connectionItem, columnObjects, conversions::from_utf16<wxString>(objects));

	m_connectionsCtrl->SetItem(connectionItem, columnOrigin, conversions::from_utf16<wxString>(getText(_S("ui.mainframe.connections.origin.") + connectionInfo->getOrigin())));

	m_connectionsCtrl->SetItem(connectionItem, columnLastEvent, conversions::from_utf16<wxString>(connectionStatus->getLastEvent()));

	connectionInfo->resetModifiedFlag();
}
Exemplo n.º 4
0
 Px4MultiRotor(const AirSimSettings::VehicleSettings& vehicle_settings, std::shared_ptr<const SensorFactory> sensor_factory)
     : sensor_factory_(sensor_factory)
 {
     connection_info_ = getConnectionInfo(vehicle_settings);
 }