00001 //-*-c++-*- 00002 /*************************************************************************** 00003 * Copyright (C) 2003 by Fred Schaettgen * 00004 * kdebluetooth@schaettgen.de * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 2 of the License, or * 00009 * (at your option) any later version. * 00010 ***************************************************************************/ 00011 00012 #ifndef OTUUID_H 00013 #define OTUUID_H 00014 00015 #include <qstring.h> 00016 #include <qarray.h> 00017 #include <bluezlib.h> 00018 00019 namespace Opietooth2 { 00020 00021 class OTUUID; 00022 00023 typedef QArray<OTUUID> UUIDVector; 00024 00025 class OTUUID { 00026 00027 public : 00028 00029 OTUUID( QString s ); 00030 OTUUID( uint64_t l=0, uint64_t h=0); 00031 OTUUID( const OTUUID & O ); 00032 00033 bool fromString(QString s); 00034 00035 void setUUID128(uint64_t hi, uint64_t lo); 00036 00037 void setUUID32(uint32_t v); 00038 00039 uint16_t toShort() 00040 { return ((hi>>32) & 0xffff); } 00041 uint32_t toLong() 00042 { return ((hi>>32) & 0xffffffff); } 00043 uint64_t toLongLong() 00044 { return hi; } 00045 00046 QString toString() const ; 00047 operator QString() const; 00048 operator ::uuid_t() const; 00049 00050 OTUUID & operator=( const OTUUID & other ) ; 00051 bool operator<( const OTUUID & other ) const; 00052 bool operator==(const OTUUID & uuid) const; 00053 00054 uint64_t hi; 00055 uint64_t lo; 00056 }; 00057 } 00058 #endif
1.4.2