javaextensions/bluetooth/omjbluetooth/inc/bluetoothstructs.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BLUETOOTHSTRUCTS_H
       
    20 #define BLUETOOTHSTRUCTS_H
       
    21 
       
    22 namespace java
       
    23 {
       
    24 namespace bluetooth
       
    25 {
       
    26 
       
    27 #define STATUS_DEVICE_FOUND       1
       
    28 
       
    29 class DiscoveredDevice
       
    30 {
       
    31 public:
       
    32     DiscoveredDevice()
       
    33     {
       
    34         mInquiryStatus = 0;
       
    35         mDeviceClass = 0;
       
    36         mErrVal = 0;
       
    37         mDeviceAddr = NULL;
       
    38         mDeviceName = NULL;
       
    39     }
       
    40 
       
    41     ~DiscoveredDevice()
       
    42     {
       
    43         delete mDeviceAddr;
       
    44         delete mDeviceName;
       
    45     }
       
    46 
       
    47     DiscoveredDevice(const DiscoveredDevice &aDiscoveredDevice)
       
    48     {
       
    49         mInquiryStatus = aDiscoveredDevice.mInquiryStatus;
       
    50         mDeviceClass = aDiscoveredDevice.mDeviceClass;
       
    51         mErrVal = aDiscoveredDevice.mErrVal;
       
    52         if (aDiscoveredDevice.mDeviceAddr)
       
    53             mDeviceAddr = new std::wstring(*(aDiscoveredDevice.mDeviceAddr));
       
    54         if (aDiscoveredDevice.mDeviceName)
       
    55             mDeviceName = new std::wstring(*(aDiscoveredDevice.mDeviceName));
       
    56     }
       
    57 
       
    58     DiscoveredDevice& DiscoveredDevice::operator=(
       
    59         const DiscoveredDevice &aDiscoveredDevice)
       
    60     {
       
    61         mInquiryStatus = aDiscoveredDevice.mInquiryStatus;
       
    62         mDeviceClass = aDiscoveredDevice.mDeviceClass;
       
    63         mErrVal = aDiscoveredDevice.mErrVal;
       
    64         if (aDiscoveredDevice.mDeviceAddr)
       
    65             mDeviceAddr = new std::wstring(*(aDiscoveredDevice.mDeviceAddr));
       
    66         if (aDiscoveredDevice.mDeviceName)
       
    67             mDeviceName = new std::wstring(*(aDiscoveredDevice.mDeviceName));
       
    68 
       
    69         return *this;
       
    70     }
       
    71 
       
    72     void clean()
       
    73     {
       
    74         mInquiryStatus = 0;
       
    75         mDeviceClass = 0;
       
    76         mErrVal = 0;
       
    77         delete mDeviceAddr;
       
    78         mDeviceAddr = NULL;
       
    79         delete mDeviceName;
       
    80         mDeviceName = NULL;
       
    81     }
       
    82 
       
    83     int mInquiryStatus; //set to 0 usually. In case of inquiryCompleted callback
       
    84     //will be set to either Inquiry_Completed or Inquiry error or Inquiry terminated
       
    85     int mErrVal; // In case of any err, this contains the error value.
       
    86     int mDeviceClass;
       
    87     std::wstring* mDeviceAddr;
       
    88     std::wstring* mDeviceName;
       
    89 };
       
    90 
       
    91 } //end namespace bluetooth
       
    92 } //end namespace java
       
    93 
       
    94 #endif // BLUETOOTHSTRUCTS_H