Ticket #9265: bluetoothUI-v2.patch
File bluetoothUI-v2.patch, 18.9 KB (added by , 12 years ago) |
---|
-
new file headers/private/bluetooth/BluetoothIconView.h
diff --git a/headers/private/bluetooth/BluetoothIconView.h b/headers/private/bluetooth/BluetoothIconView.h new file mode 100644 index 0000000..159c9ca
- + 1 /* 2 * Copyright 2012, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Tri-Edge AI <triedgeai@gmail.com> 7 */ 8 9 #ifndef _BLUETOOTH_ICON_VIEW_H_ 10 #define _BLUETOOTH_ICON_VIEW_H_ 11 12 #include <View.h> 13 #include <Bitmap.h> 14 #include <MimeType.h> 15 #include <IconUtils.h> 16 17 namespace Bluetooth 18 { 19 20 class BluetoothIconView : public BView 21 { 22 public: 23 BluetoothIconView(); 24 ~BluetoothIconView(); 25 26 void Draw(BRect rect); 27 28 private: 29 static BBitmap* fBitmap; 30 static int32 fRefCount; 31 }; 32 33 } 34 35 #endif /* _BLUETOOTH_ICON_VIEW_H_ */ -
headers/private/bluetooth/ConnectionIncoming.h
diff --git a/headers/private/bluetooth/ConnectionIncoming.h b/headers/private/bluetooth/ConnectionIncoming.h index f8292f8..831efc4 100644
a b 1 /* 2 * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * 4 * All rights reserved. Distributed under the terms of the MIT License. 5 * 6 */ 1 /* 2 * Copyright 2012, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com> 7 * Tri-Edge AI <triedgeai@gmail.com> 8 */ 7 9 8 10 #ifndef _CONNECTION_INCOMING_H_ 9 11 #define _CONNECTION_INCOMING_H_ 10 12 11 12 //----------------------- Global includes ----------------------13 13 #include <AppKit.h> 14 14 #include <SupportKit.h> 15 15 #include <InterfaceKit.h> 16 17 #include <ConnectionView.h> 18 #include <bluetooth/RemoteDevice.h> 19 #include <bluetooth/bdaddrUtils.h> 20 16 21 #include <iostream> 17 22 #include <stdio.h> 18 23 #include <stdlib.h> 19 24 20 namespace Bluetooth { 21 22 class RemoteDevice; 23 24 class ConnectionView 25 : public BView 25 namespace Bluetooth 26 26 { 27 public:28 ConnectionView(BRect frame, const char *name);29 ~ConnectionView();30 virtual void MessageReceived(BMessage *message);31 void Draw(BRect update);32 void Pulse();33 34 private:35 36 37 };38 27 28 class RemoteDevice; 29 class ConnectionView; 39 30 40 31 class ConnectionIncoming : public BWindow 41 32 { 42 33 public: 43 ConnectionIncoming(RemoteDevice* rDevice); 34 ConnectionIncoming(bdaddr_t address); 35 ConnectionIncoming(RemoteDevice* rDevice = NULL); 44 36 ~ConnectionIncoming(); 45 virtual void MessageReceived(BMessage *message); 37 38 virtual void MessageReceived(BMessage* message); 46 39 virtual bool QuitRequested(); 47 40 48 41 private: 49 ConnectionView* _ConnectionView;42 ConnectionView* fView; 50 43 }; 51 44 52 45 } … … private: 55 48 using Bluetooth::ConnectionIncoming; 56 49 #endif 57 50 58 59 #endif 51 #endif /* _CONNECTION_INCOMING_H_ */ -
new file headers/private/bluetooth/ConnectionView.h
diff --git a/headers/private/bluetooth/ConnectionView.h b/headers/private/bluetooth/ConnectionView.h new file mode 100644 index 0000000..ef45341
- + 1 /* 2 * Copyright 2012, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Tri-Edge AI <triedgeai@gmail.com> 7 */ 8 9 #ifndef _CONNECTION_VIEW_H_ 10 #define _CONNECTION_VIEW_H_ 11 12 #include <Window.h> 13 #include <View.h> 14 #include <StringView.h> 15 #include <GroupLayout.h> 16 #include <GroupLayoutBuilder.h> 17 #include <Font.h> 18 #include <String.h> 19 20 namespace Bluetooth 21 { 22 23 class BluetoothIconView; 24 25 class ConnectionView : public BView 26 { 27 public: 28 ConnectionView::ConnectionView(BRect frame, 29 BString device, BString address); 30 31 void Pulse(); 32 33 private: 34 BString strMessage; 35 BluetoothIconView* fIcon; 36 BStringView* fMessage; 37 BStringView* fDeviceLabel; 38 BStringView* fDeviceText; 39 BStringView* fAddressLabel; 40 BStringView* fAddressText; 41 }; 42 43 } 44 45 #endif /* _CONNECTION_VIEW_H_ */ -
headers/private/bluetooth/PincodeWindow.h
diff --git a/headers/private/bluetooth/PincodeWindow.h b/headers/private/bluetooth/PincodeWindow.h index c7bb86b..911aaec 100644
a b 1 /* 2 * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PINCODE_REQUEST_WINDOW_H 6 #define _PINCODE_REQUEST_WINDOW_H 7 1 /* 2 * Copyright 2012, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com> 7 * Tri-Edge AI <triedgeai@gmail.com> 8 */ 9 10 #ifndef _PINCODE_REQUEST_WINDOW_H_ 11 #define _PINCODE_REQUEST_WINDOW_H_ 8 12 9 13 #include <View.h> 10 14 #include <Window.h> … … 12 16 #include <bluetooth/bluetooth.h> 13 17 #include <bluetooth/HCI/btHCI.h> 14 18 19 #include <BluetoothIconView.h> 20 15 21 class BStringView; 16 22 class BButton; 17 23 class BTextControl; 18 24 19 namespace Bluetooth { 25 namespace Bluetooth 26 { 20 27 21 28 class RemoteDevice; 22 29 23 30 class PincodeWindow : public BWindow 24 31 { 25 32 public: 26 PincodeWindow(bdaddr_t address, hci_id hid);27 PincodeWindow(RemoteDevice* rDevice);28 virtual void MessageReceived(BMessage *msg);29 virtual bool QuitRequested();30 void SetBDaddr(const char* address);33 PincodeWindow(bdaddr_t address, hci_id hid); 34 PincodeWindow(RemoteDevice* rDevice); 35 virtual void MessageReceived(BMessage *msg); 36 virtual bool QuitRequested(); 37 void SetBDaddr(const char* address); 31 38 32 39 private: 33 void InitUI(); 34 bdaddr_t fBdaddr; 35 hci_id fHid; 36 37 BStringView* fMessage; 38 BStringView* fRemoteInfo; 39 BButton* fAcceptButton; 40 BButton* fCancelButton; 41 BTextControl* fPincodeText; 40 void InitUI(); 41 bdaddr_t fBdaddr; 42 hci_id fHid; 43 44 BluetoothIconView* fIcon; 45 BStringView* fMessage; 46 BStringView* fMessage2; 47 BStringView* fDeviceLabel; 48 BStringView* fDeviceText; 49 BStringView* fAddressLabel; 50 BStringView* fAddressText; 51 BButton* fAcceptButton; 52 BButton* fCancelButton; 53 BTextControl* fPINCode; 42 54 }; 43 55 44 56 } … … private: 47 59 using Bluetooth::PincodeWindow; 48 60 #endif 49 61 50 #endif 62 #endif /* _PINCODE_REQUEST_WINDOW_H_ */ -
new file src/kits/bluetooth/UI/BluetoothIconView.cpp
diff --git a/src/kits/bluetooth/UI/BluetoothIconView.cpp b/src/kits/bluetooth/UI/BluetoothIconView.cpp new file mode 100644 index 0000000..5a2a817
- + 1 /* 2 * Copyright 2012, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Tri-Edge AI <triedgeai@gmail.com> 7 */ 8 9 #include <BluetoothIconView.h> 10 11 #include <stdio.h> 12 13 namespace Bluetooth 14 { 15 16 BBitmap* BluetoothIconView::fBitmap = NULL; 17 int32 BluetoothIconView::fRefCount = 0; 18 19 BluetoothIconView::BluetoothIconView() 20 : 21 BView(BRect(0, 0, 80, 80), "", B_FOLLOW_ALL, B_WILL_DRAW) 22 { 23 if (fRefCount == 0) { 24 fBitmap = new BBitmap(BRect(0, 0, 64, 64), 0, B_RGBA32); 25 26 uint8* tempIcon; 27 size_t tempSize; 28 29 BMimeType mime("application/x-vnd.Haiku-bluetooth_server"); 30 mime.GetIcon(&tempIcon, &tempSize); 31 32 BIconUtils::GetVectorIcon(tempIcon, tempSize, fBitmap); 33 34 fRefCount++; 35 } else { 36 fRefCount++; 37 } 38 39 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 40 SetDrawingMode(B_OP_ALPHA); 41 SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY); 42 } 43 44 45 BluetoothIconView::~BluetoothIconView() 46 { 47 fRefCount--; 48 49 if (fRefCount <= 0) 50 delete fBitmap; 51 } 52 53 54 void 55 BluetoothIconView::Draw(BRect rect) 56 { 57 this->DrawBitmap(fBitmap); 58 } 59 60 } -
src/kits/bluetooth/UI/ConnectionIncoming.cpp
diff --git a/src/kits/bluetooth/UI/ConnectionIncoming.cpp b/src/kits/bluetooth/UI/ConnectionIncoming.cpp index 1aced3a..bac0aed 100644
a b 1 /* 2 * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * 4 * All rights reserved. Distributed under the terms of the MIT License. 5 * 6 */ 1 /* 2 * Copyright 2012, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com> 7 * Tri-Edge AI <triedgeai@gmail.com> 8 */ 7 9 8 10 #include <ConnectionIncoming.h> 11 #include <ConnectionView.h> 9 12 10 #define B_PULSES_BY_SECOND(x) (2*x) 11 12 namespace Bluetooth { 13 14 ConnectionView::ConnectionView(BRect frame, const char *name): BView(BRect(0, 0, 400, 400), "MyViewName", 15 B_FOLLOW_LEFT | B_FOLLOW_TOP, 16 B_WILL_DRAW | B_PULSE_NEEDED) 13 namespace Bluetooth 17 14 { 18 15 19 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 20 21 } 22 23 ConnectionView::~ConnectionView() 16 ConnectionIncoming::ConnectionIncoming(bdaddr_t address) 17 : 18 BWindow(BRect(600, 100, 1000, 180), "Incoming Connection", 19 B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 20 B_NOT_ZOOMABLE | B_NOT_RESIZABLE) 21 // 400x80 24 22 { 25 26 } 27 28 29 void ConnectionView::MessageReceived(BMessage *message) 30 { 31 switch(message->what) 32 { 33 default: 23 SetPulseRate(1 * 1000 * 1000); 24 // 1 second 34 25 35 break; 36 } 37 } 38 39 40 void ConnectionView::Draw(BRect update) 41 { 42 43 } 44 45 46 void ConnectionView::Pulse() 47 { 48 static int a = 0; 26 fView = new ConnectionView(BRect(0, 0, 400, 80), "<unknown_device>", 27 bdaddrUtils::ToString(address)); 49 28 50 if (a++ == B_PULSES_BY_SECOND(5)) { 51 // BUG: for some reason the window is not being removed... 52 Window()->PostMessage(B_QUIT_REQUESTED); 53 Window()->Quit(); 54 } 29 AddChild(fView); 55 30 } 56 31 57 32 58 59 //--------------------------------------------------------------- 60 ConnectionIncoming::ConnectionIncoming(RemoteDevice* rDevice) 61 : BWindow(BRect(700, 100, 900, 150), "Connection completed",62 B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 63 B_NOT_ZOOMABLE | B_NOT_RESIZABLE) 33 ConnectionIncoming::ConnectionIncoming(RemoteDevice* rDevice = NULL) 34 : 35 BWindow(BRect(600, 100, 1000, 180), "Incoming Connection", 36 B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 37 B_NOT_ZOOMABLE | B_NOT_RESIZABLE) 38 // 400x80 64 39 { 65 _ConnectionView = new ConnectionView(BRect(0, 0, 400, 400),"mViewName"); 66 67 AddChild(_ConnectionView); 40 SetPulseRate(1 * 1000 * 1000); 41 // 1 second 42 43 if (rDevice != NULL) 44 fView = new ConnectionView(BRect(0, 0, 400, 80), rDevice->GetFriendlyName(), 45 bdaddrUtils::ToString(rDevice->GetBluetoothAddress())); 46 else 47 fView = new ConnectionView(BRect(0, 0, 400, 80), "<unknown_device>", 48 bdaddrUtils::ToString(bdaddrUtils::NullAddress())); 49 50 AddChild(fView); 68 51 } 69 52 70 53 71 54 ConnectionIncoming::~ConnectionIncoming() 72 55 { 73 56 74 57 } 75 58 76 59 77 void ConnectionIncoming::MessageReceived(BMessage *message) 60 void 61 ConnectionIncoming::MessageReceived(BMessage* message) 78 62 { 79 switch (message->what)63 switch (message->what) 80 64 { 81 65 default: 82 66 … … void ConnectionIncoming::MessageReceived(BMessage *message) 85 69 } 86 70 87 71 88 bool ConnectionIncoming::QuitRequested() 72 bool 73 ConnectionIncoming::QuitRequested() 89 74 { 90 75 return BWindow::QuitRequested(); 91 76 } -
new file src/kits/bluetooth/UI/ConnectionView.cpp
diff --git a/src/kits/bluetooth/UI/ConnectionView.cpp b/src/kits/bluetooth/UI/ConnectionView.cpp new file mode 100644 index 0000000..1639c33
- + 1 /* 2 * Copyright 2012, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Tri-Edge AI <triedgeai@gmail.com> 7 */ 8 9 #include <ConnectionView.h> 10 #include <BluetoothIconView.h> 11 12 namespace Bluetooth 13 { 14 15 ConnectionView::ConnectionView(BRect frame, BString device, BString address) 16 : 17 BView(frame, "ConnectionView", 0, B_PULSE_NEEDED) 18 { 19 SetLayout(new BGroupLayout(B_HORIZONTAL)); 20 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 21 22 fIcon = new BluetoothIconView(); 23 24 strMessage = "A new connection is incoming.."; 25 26 fMessage = new BStringView(frame, "", strMessage, B_FOLLOW_LEFT); 27 fMessage->SetAlignment(B_ALIGN_LEFT); 28 29 fDeviceLabel = new BStringView(frame, "", "Device Name:", B_FOLLOW_LEFT); 30 fDeviceLabel->SetFont(be_bold_font); 31 32 fDeviceText = new BStringView(frame, "", device, B_FOLLOW_RIGHT); 33 fDeviceText->SetAlignment(B_ALIGN_RIGHT); 34 35 fAddressLabel = new BStringView(frame, "", "MAC Address:", B_FOLLOW_LEFT); 36 37 //fAddressLabel->SetFont(be_bold_font); 38 // TriEdgeAI: IMHO, it looks better when both a bolded. 39 // I'm leaving it here, so you can decide. 40 41 fAddressText = new BStringView(frame, "", address, B_FOLLOW_RIGHT); 42 43 AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 0) 44 .Add(BGroupLayoutBuilder(B_VERTICAL, 8) 45 .Add(fIcon) 46 ) 47 .Add(BGroupLayoutBuilder(B_VERTICAL, 0) 48 .Add(fMessage) 49 .AddGlue() 50 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 42) 51 .Add(fDeviceLabel) 52 .AddGlue() 53 .Add(fDeviceText) 54 ) 55 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 42) 56 .Add(fAddressLabel) 57 .AddGlue() 58 .Add(fAddressText) 59 ) 60 .AddGlue() 61 ) 62 .AddGlue() 63 .SetInsets(8, 8, 8, 8) 64 ); 65 } 66 67 68 void 69 ConnectionView::Pulse() 70 { 71 static int pulses = 0; 72 73 pulses++; 74 75 if (pulses >= 5) { 76 Window()->PostMessage(B_QUIT_REQUESTED); 77 } else { 78 strMessage += "."; 79 fMessage->SetText(strMessage); 80 } 81 } 82 83 } -
src/kits/bluetooth/UI/PincodeWindow.cpp
diff --git a/src/kits/bluetooth/UI/PincodeWindow.cpp b/src/kits/bluetooth/UI/PincodeWindow.cpp index 65b1ae5..a48e91c 100644
a b 1 /* 2 * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 1 /* 2 * Copyright 2012, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com> 7 * Tri-Edge AI <triedgeai@gmail.com> 8 */ 5 9 6 10 #include <stdio.h> 7 11 #include <unistd.h> … … 30 34 #include <bluetoothserver_p.h> 31 35 #include <CommandManager.h> 32 36 33 34 37 #define H_SEPARATION 15 35 38 #define V_SEPARATION 10 36 39 #define BD_ADDR_LABEL "BD_ADDR: " … … 38 41 static const uint32 skMessageAcceptButton = 'acCp'; 39 42 static const uint32 skMessageCancelButton = 'mVch'; 40 43 41 42 namespace Bluetooth { 43 44 45 #if 0 46 #pragma mark - 47 #endif 44 namespace Bluetooth 45 { 48 46 49 47 PincodeWindow::PincodeWindow(bdaddr_t address, hci_id hid) 50 : BWindow(BRect( 800, 200, 900, 300), "Pincode request",51 B_FLOATING_WINDOW ,52 B_ WILL_ACCEPT_FIRST_CLICK | B_NOT_RESIZABLE| B_NOT_ZOOMABLE53 | B_AUTO_UPDATE_SIZE_LIMITS,54 B_ALL_WORKSPACES), fBdaddr(address),fHid(hid)48 : BWindow(BRect(700, 200, 1000, 400), "PIN Code Request", 49 B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 50 B_NOT_ZOOMABLE | B_NOT_RESIZABLE), 51 fBdaddr(address), 52 fHid(hid) 55 53 { 56 54 InitUI(); 57 55 58 56 // TODO: Get more info about device" ote name/features/encry/auth... etc 59 57 SetBDaddr(bdaddrUtils::ToString(fBdaddr)); 60 61 58 } 62 59 63 60 64 61 PincodeWindow::PincodeWindow(RemoteDevice* rDevice) 65 : BWindow(BRect(800, 200, 900, 300), "Pincode request", 66 B_FLOATING_WINDOW, 67 B_WILL_ACCEPT_FIRST_CLICK | B_NOT_ZOOMABLE | B_NOT_RESIZABLE 68 | B_AUTO_UPDATE_SIZE_LIMITS, 69 B_ALL_WORKSPACES) 62 : BWindow(BRect(700, 200, 1000, 400), "PIN Code Request", 63 B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 64 B_NOT_ZOOMABLE | B_NOT_RESIZABLE) 70 65 { 66 InitUI(); 67 71 68 // TODO: Get more info about device" ote name/features/encry/auth... etc 69 fDeviceText->SetText(rDevice->GetFriendlyName()); 72 70 SetBDaddr(bdaddrUtils::ToString(rDevice->GetBluetoothAddress())); 73 71 fHid = (rDevice->GetLocalDeviceOwner())->ID(); 74 72 } … … PincodeWindow::InitUI() 79 77 { 80 78 SetLayout(new BGroupLayout(B_HORIZONTAL)); 81 79 82 fMessage = new BStringView("Pincode", "Please enter the pincode ..."); 83 fMessage->SetFont(be_bold_font); 84 85 fRemoteInfo = new BStringView("bdaddr","BD_ADDR: "); 86 87 // TODO: Pincode cannot be more than 16 bytes 88 fPincodeText = new BTextControl("pincode TextControl", "PIN code:", "5555", NULL); 89 80 fIcon = new BluetoothIconView(); 81 82 fMessage = new BStringView("fMessage", "Input the PIN code to pair with"); 83 fMessage2 = new BStringView("fMessage2", "the following Bluetooth device."); 84 85 fDeviceLabel = new BStringView("fDeviceLabel","Device Name: "); 86 fDeviceLabel->SetFont(be_bold_font); 87 88 fDeviceText = new BStringView("fDeviceText", "<unknown_device>"); 89 fAddressLabel = new BStringView("fAddressLabel", "MAC Address: "); 90 //fAddressLabel->SetFont(be_bold_font); 91 // TriEdgeAI: IMHO, it looks better when both a bolded. 92 // I'm leaving it here, so you can decide. 93 94 fAddressText = new BStringView("fAddressText", "<mac_address>"); 95 96 fPINCode = new BTextControl("fPINCode", "PIN Code:", "0000", NULL); 97 fPINCode->TextView()->SetMaxBytes(16 * sizeof(fPINCode->Text()[0])); 98 fPINCode->MakeFocus(); 99 90 100 fAcceptButton = new BButton("fAcceptButton", "Pair", 91 101 new BMessage(skMessageAcceptButton)); 92 102 93 103 fCancelButton = new BButton("fCancelButton", "Cancel", 94 104 new BMessage(skMessageCancelButton)); 95 105 96 AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) 106 AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) 107 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) 108 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 8) 109 .Add(fIcon) 110 ) 111 .Add(BGroupLayoutBuilder(B_VERTICAL, 0) 97 112 .Add(fMessage) 98 .Add(fRemoteInfo) 99 .Add(fPincodeText) 100 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) 101 .AddGlue() 102 .Add(fCancelButton) 103 .Add(fAcceptButton) 104 .SetInsets(5, 5, 5, 5) 105 ) 106 .SetInsets(15, 15, 15, 15) 113 .Add(fMessage2) 114 .AddGlue() 115 ) 116 ) 117 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) 118 .Add(fDeviceLabel) 119 .AddGlue() 120 .Add(fDeviceText) 121 ) 122 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) 123 .Add(fAddressLabel) 124 .AddGlue() 125 .Add(fAddressText) 126 ) 127 .AddGlue() 128 .Add(fPINCode) 129 .AddGlue() 130 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) 131 .AddGlue() 132 .Add(fCancelButton) 133 .Add(fAcceptButton) 134 ) 135 .SetInsets(8, 8, 8, 8) 107 136 ); 108 137 } 109 138 … … PincodeWindow::InitUI() 111 140 void 112 141 PincodeWindow::MessageReceived(BMessage *msg) 113 142 { 114 // status_t err = B_OK; 115 116 switch(msg->what) 143 switch (msg->what) 117 144 { 118 145 case skMessageAcceptButton: 119 146 { … … PincodeWindow::MessageReceived(BMessage *msg) 123 150 int8 bt_status = BT_ERROR; 124 151 125 152 void* command = buildPinCodeRequestReply(fBdaddr, 126 strlen(fP incodeText->Text()),127 (char*)fP incodeText->Text(), &size);153 strlen(fPINCode->Text()), 154 (char*)fPINCode->Text(), &size); 128 155 129 156 if (command == NULL) { 130 157 break; … … PincodeWindow::MessageReceived(BMessage *msg) 138 165 139 166 // we reside in the server 140 167 if (be_app_messenger.SendMessage(&request, &reply) == B_OK) { 141 if (reply.FindInt8("status", &bt_status ) == B_OK 168 if (reply.FindInt8("status", &bt_status ) == B_OK) { 142 169 PostMessage(B_QUIT_REQUESTED); 143 170 } 144 171 // TODO: something failed here … … PincodeWindow::MessageReceived(BMessage *msg) 181 208 } 182 209 183 210 184 bool PincodeWindow::QuitRequested() 211 bool 212 PincodeWindow::QuitRequested() 185 213 { 186 214 return BWindow::QuitRequested(); 187 215 } 188 216 189 217 190 void PincodeWindow::SetBDaddr(const char* address) 218 void 219 PincodeWindow::SetBDaddr(const char* address) 191 220 { 192 BString label; 193 194 label << BD_ADDR_LABEL << address; 195 printf("++ %s\n",label.String()); 196 fRemoteInfo->SetText(label.String()); 197 fRemoteInfo->ResizeToPreferred(); 198 //Invalidate(); 199 221 fAddressText->SetText(address); 200 222 } 201 223 202 203 224 }