xref: /haiku/src/kits/bluetooth/UI/ConnectionIncoming.cpp (revision 91cbfa855ee63eae9eff3131a2f8712b0333d395)
1b12daa5fSOliver Ruiz Dorantes /*
2*91cbfa85SFredrik Modéen  * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
316196fd3SFredrik Modéen  * Copyright 2021, Haiku, Inc.
416196fd3SFredrik Modéen  * Distributed under the terms of the MIT License.
516196fd3SFredrik Modéen  *
616196fd3SFredrik Modéen  * Authors:
716196fd3SFredrik Modéen  * 		Tri-Edge AI <triedgeai@gmail.com>
8b12daa5fSOliver Ruiz Dorantes  */
9b12daa5fSOliver Ruiz Dorantes 
1019733b44SAlexander von Gluck IV 
11b12daa5fSOliver Ruiz Dorantes #include <ConnectionIncoming.h>
1216196fd3SFredrik Modéen #include <ConnectionView.h>
13b12daa5fSOliver Ruiz Dorantes 
1416196fd3SFredrik Modéen namespace Bluetooth
1516196fd3SFredrik Modéen {
16f696e88aSlooncraz 
ConnectionIncoming(bdaddr_t address)1716196fd3SFredrik Modéen ConnectionIncoming::ConnectionIncoming(bdaddr_t address)
18f696e88aSlooncraz 	:
1916196fd3SFredrik Modéen 	BWindow(BRect(600, 100, 1000, 180), "Incoming Connection..",
2016196fd3SFredrik Modéen 		B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
2116196fd3SFredrik Modéen 			B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
2216196fd3SFredrik Modéen 					// 400x80
23b12daa5fSOliver Ruiz Dorantes {
2416196fd3SFredrik Modéen 	SetPulseRate(1 * 1000 * 1000);
2516196fd3SFredrik Modéen 		// 1 second
2616196fd3SFredrik Modéen 	fView = new ConnectionView(BRect(0, 0, 400, 80), "<unknown_device>",
2716196fd3SFredrik Modéen 		bdaddrUtils::ToString(address));
2816196fd3SFredrik Modéen 	AddChild(fView);
29b12daa5fSOliver Ruiz Dorantes }
30b12daa5fSOliver Ruiz Dorantes 
31f696e88aSlooncraz 
ConnectionIncoming(RemoteDevice * rDevice)32b12daa5fSOliver Ruiz Dorantes ConnectionIncoming::ConnectionIncoming(RemoteDevice* rDevice)
33f696e88aSlooncraz 	:
3416196fd3SFredrik Modéen 	BWindow(BRect(600, 100, 1000, 180), "Incoming Connection",
35b12daa5fSOliver Ruiz Dorantes 		B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
36b12daa5fSOliver Ruiz Dorantes 		B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
37b12daa5fSOliver Ruiz Dorantes {
3816196fd3SFredrik Modéen 	SetPulseRate(1 * 1000 * 1000);
3916196fd3SFredrik Modéen 		// 1 second
40b12daa5fSOliver Ruiz Dorantes 
4116196fd3SFredrik Modéen 	if (rDevice != NULL)
4216196fd3SFredrik Modéen 		fView = new ConnectionView(BRect(0, 0, 400, 80), rDevice->GetFriendlyName(),
4316196fd3SFredrik Modéen 					bdaddrUtils::ToString(rDevice->GetBluetoothAddress()));
4416196fd3SFredrik Modéen 	else
4516196fd3SFredrik Modéen 		fView = new ConnectionView(BRect(0, 0, 400, 80), "<unknown_device>",
4616196fd3SFredrik Modéen 					bdaddrUtils::ToString(bdaddrUtils::NullAddress()));
4716196fd3SFredrik Modéen 
4816196fd3SFredrik Modéen 	AddChild(fView);
49b12daa5fSOliver Ruiz Dorantes }
50b12daa5fSOliver Ruiz Dorantes 
513205e523SOliver Ruiz Dorantes 
~ConnectionIncoming()52b12daa5fSOliver Ruiz Dorantes ConnectionIncoming::~ConnectionIncoming()
53b12daa5fSOliver Ruiz Dorantes {
54b12daa5fSOliver Ruiz Dorantes }
55b12daa5fSOliver Ruiz Dorantes 
563205e523SOliver Ruiz Dorantes 
5716196fd3SFredrik Modéen void
MessageReceived(BMessage * message)5816196fd3SFredrik Modéen ConnectionIncoming::MessageReceived(BMessage* message)
59b12daa5fSOliver Ruiz Dorantes {
60b12daa5fSOliver Ruiz Dorantes }
61b12daa5fSOliver Ruiz Dorantes 
623205e523SOliver Ruiz Dorantes 
6316196fd3SFredrik Modéen bool
QuitRequested()6416196fd3SFredrik Modéen ConnectionIncoming::QuitRequested()
65b12daa5fSOliver Ruiz Dorantes {
66b12daa5fSOliver Ruiz Dorantes 	return BWindow::QuitRequested();
67b12daa5fSOliver Ruiz Dorantes }
68b12daa5fSOliver Ruiz Dorantes 
69f696e88aSlooncraz 
7019733b44SAlexander von Gluck IV } /* end namespace Bluetooth */
71