本文整理汇总了C++中CCommsDbTableView::UpdateRecord方法的典型用法代码示例。如果您正苦于以下问题:C++ CCommsDbTableView::UpdateRecord方法的具体用法?C++ CCommsDbTableView::UpdateRecord怎么用?C++ CCommsDbTableView::UpdateRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCommsDbTableView
的用法示例。
在下文中一共展示了CCommsDbTableView::UpdateRecord方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetLocalIpAddrL
/**
* Function that takes an IP address from user input, accesses the
* Bluetooth PAN Profile table in the CommDb and updates the IpAddr
* field with the supplied address.
*/
void CPanConnections::SetLocalIpAddrL(TUint32 addr)
{
iLocalIpAddr = addr;
iSrcAddr.SetAddress(iLocalIpAddr);
CCommsDatabase* db = CCommsDatabase::NewL();
CleanupStack::PushL(db);
// Get the LAN service table
CCommsDbTableView* tableView = db->OpenTableLC(TPtrC(LAN_SERVICE));
TBuf<KMaxBufferSize> tableName;
TInt err = tableView->GotoFirstRecord();
if(err == KErrNone)
{
// Get the name of the table
tableView->ReadTextL(TPtrC(COMMDB_NAME), tableName);
if(tableName == TPtrC(_S("BluetoothPANProfile")))
{
TInetAddr tempAddr;
TBuf<KMaxBufferSize> dispBuf;
tempAddr.SetAddress(iLocalIpAddr);
tempAddr.Output(dispBuf);
User::LeaveIfError(tableView->UpdateRecord());
tableView->WriteTextL(_L("IpAddr"), dispBuf);
User::LeaveIfError(tableView->PutRecordChanges());
User::LeaveIfError(db->CommitTransaction());
}
}
else
{
User::Leave(KErrNotFound);
}
CleanupStack::PopAndDestroy(2);//db & tableView
}
示例2: storeWPADataL
void XQAccessPointManagerPrivate::storeWPADataL(const TInt aIapId, const TDesC& aPresharedKey, const XQWLAN& aWlan)
{
CCommsDbTableView* wLanServiceTable;
CApUtils* apUtils = CApUtils::NewLC(*ipCommsDB);
TUint32 iapId = apUtils->IapIdFromWapIdL(aIapId);
CleanupStack::PopAndDestroy(apUtils);
TUint32 serviceId;
CCommsDbTableView* iapTable = ipCommsDB->OpenViewMatchingUintLC(TPtrC(IAP),
TPtrC(COMMDB_ID),
iapId);
User::LeaveIfError(iapTable->GotoFirstRecord());
iapTable->ReadUintL(TPtrC(IAP_SERVICE), serviceId);
CleanupStack::PopAndDestroy( iapTable );
wLanServiceTable = ipCommsDB->OpenViewMatchingUintLC(TPtrC(XQ_WLAN_SERVICE),
TPtrC(XQ_WLAN_SERVICE_ID),
serviceId );
TInt errorCode = wLanServiceTable->GotoFirstRecord();
if (errorCode == KErrNone) {
User::LeaveIfError(wLanServiceTable->UpdateRecord());
} else {
TUint32 dummyUid(0);
User::LeaveIfError(wLanServiceTable->InsertRecord(dummyUid));
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_SERVICE_ID), aIapId);
}
CleanupCancelPushL(*wLanServiceTable);
TBool usesPsk(aWlan.usesPreSharedKey());
// Save WPA Mode
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_ENABLE_WPA_PSK), usesPsk);
// Save security mode
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_SECURITY_MODE),
fromQtSecurityModeToS60SecurityMode(aWlan.securityMode()));
// Save PreShared Key
TBuf8<KWpaKeyMaxLength> keyWPA;
//convert to 8 bit
keyWPA.Copy(aPresharedKey);
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WPA_PRE_SHARED_KEY),keyWPA);
// Check and save PreShared Key Length
TInt len(keyWPA.Length());
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WPA_KEY_LENGTH),len);
User::LeaveIfError(wLanServiceTable->PutRecordChanges());
CleanupStack::Pop(wLanServiceTable); // table rollback...
CleanupStack::PopAndDestroy(wLanServiceTable);
}
示例3: ConfigureIAPL
/**
* Function that accesses the PAN Service Table in the CommsDb and configures
* the IAP to the required settings.
*/
void CPanConnections::ConfigureIAPL(TBool aIsListening, TBTDevAddr* aDevAddr, TBool aUsePANNotifier)
{
// Open CommDb and get a view of the PAN service extentions table.
CCommsDatabase* db = CCommsDatabase::NewL();
CleanupStack::PushL(db);
CCommsDbTableView* tableView = db->OpenTableLC(TPtrC(PAN_SERVICE_EXTENSIONS));
TBuf<KMaxBufferSize> tableName;
TInt err = tableView->GotoFirstRecord();
if(err == KErrNone)
{
tableView->ReadTextL(TPtrC(COMMDB_NAME), tableName);
if(tableName == TPtrC(_S("PANServiceExtensionsTable1")))
{
User::LeaveIfError(tableView->UpdateRecord());// Start update
//enable listening mode
tableView->WriteBoolL(TPtrC(PAN_ALLOW_INCOMING),aIsListening);
tableView->WriteBoolL(TPtrC(PAN_DISABLE_SDP_QUERY), 0);
tableView->WriteBoolL(TPtrC(PAN_PROMPT_FOR_REMOTE_DEVICES), aUsePANNotifier);
if(aDevAddr)
{
TBuf<KMaxBufferSize> buf;
aDevAddr->GetReadable(buf);
tableView->WriteTextL(TPtrC(PAN_PEER_MAC_ADDRESSES), buf);
}
else
{
tableView->WriteTextL(TPtrC(PAN_PEER_MAC_ADDRESSES), _L(""));
}
// Finalise changes made.
User::LeaveIfError(tableView->PutRecordChanges());// Finish update
User::LeaveIfError(db->CommitTransaction());
CleanupStack::PopAndDestroy(2); // db & tableView
return;
}
}
User::Leave(KErrNotFound);
}
示例4: SetFixedRoleL
/**
* Function that accesses the PAN Service table in the CommDb
* and applies the appropriate role, this function will be used for
* local or peer as well as the PAN role (U or Gn).
*/
void CPanConnections::SetFixedRoleL(TSide aSide, TUint aRole)
{
if (aSide == ELocalRole)
iLocalRole = aRole;
else
iPeerRole = aRole;
CCommsDatabase* db = CCommsDatabase::NewL();
CleanupStack::PushL(db);
CCommsDbTableView* tableView = db->OpenTableLC(TPtrC(PAN_SERVICE_EXTENSIONS));
TBuf<KMaxBufferSize> tableName;
TInt err = tableView->GotoFirstRecord();
if(err == KErrNone)
{
tableView->ReadTextL(TPtrC(COMMDB_NAME), tableName);
if(tableName == TPtrC(_S("PANServiceExtensionsTable1")))
{
User::LeaveIfError(tableView->UpdateRecord());
if(aSide == ELocalRole)
{
tableView->WriteBoolL(TPtrC(PAN_LOCAL_ROLE), aRole);
}
else
{
tableView->WriteBoolL(TPtrC(PAN_PEER_ROLE), aRole);
}
User::LeaveIfError(tableView->PutRecordChanges());
User::LeaveIfError(db->CommitTransaction());
CleanupStack::PopAndDestroy(2);
return;
}
}
User::Leave(KErrNotFound);
}
示例5: storeWEPDataL
void XQAccessPointManagerPrivate::storeWEPDataL(const TInt aIapId, const TDesC& aPresharedKey)
{
CCommsDbTableView* wLanServiceTable;
CApUtils* apUtils = CApUtils::NewLC(*ipCommsDB);
TUint32 iapId = apUtils->IapIdFromWapIdL(aIapId);
CleanupStack::PopAndDestroy(apUtils);
TUint32 serviceId;
CCommsDbTableView* iapTable = ipCommsDB->OpenViewMatchingUintLC(TPtrC(IAP),
TPtrC(COMMDB_ID),
iapId);
User::LeaveIfError(iapTable->GotoFirstRecord());
iapTable->ReadUintL(TPtrC(IAP_SERVICE), serviceId);
CleanupStack::PopAndDestroy(iapTable);
wLanServiceTable = ipCommsDB->OpenViewMatchingUintLC(TPtrC(XQ_WLAN_SERVICE),
TPtrC(XQ_WLAN_SERVICE_ID),
serviceId);
TInt errorCode = wLanServiceTable->GotoFirstRecord();
if (errorCode == KErrNone) {
User::LeaveIfError(wLanServiceTable->UpdateRecord());
}
else {
TUint32 dummyUid = 0;
User::LeaveIfError(wLanServiceTable->InsertRecord(dummyUid));
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_SERVICE_ID), aIapId);
}
CleanupCancelPushL(*wLanServiceTable);
// Save index of key in use
TUint32 keyInUse(KFirstWepKey);
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WEP_INDEX), keyInUse);
// Save authentication mode
TUint32 auth(0); // set to open...
if (isS60VersionGreaterThan3_1()) {
//TODO: wLanServiceTable->WriteUintL(TPtrC(NU_WLAN_AUTHENTICATION_MODE), auth);
} else {
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_AUTHENTICATION_MODE), auth);
}
// not we need to convert the key.... to 8bit and to hex... and again detect the required bits..
TBuf8<KMaxWepKeyLen> key;
//convert to 8 bit
key.Copy(aPresharedKey);
TBool useHex(EFalse);
TWepKeyLength keyLength;
TBool validKey = validWepKeyLength(aPresharedKey, useHex, keyLength);
if (!useHex) {
// Must be converted to hexa and stored as a hexa
// Ascii key is half the length of Hex
HBufC8* buf8Conv = HBufC8::NewLC(key.Length() * 2);
asciiToHex(key, buf8Conv);
if (isS60VersionGreaterThan3_1()) {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_HEX_WEP_KEY1), buf8Conv->Des());
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY1), buf8Conv->Des());
}
CleanupStack::PopAndDestroy(buf8Conv);
} else if (isHex(aPresharedKey)) {
//already in hexa format
if (isS60VersionGreaterThan3_1()) {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_HEX_WEP_KEY1), key);
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY1), key);
}
}
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WEP_KEY1_FORMAT), useHex);
key.Zero();
// write default values to the rest of the columns
if (isS60VersionGreaterThan3_1()) {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_HEX_WEP_KEY2),
key);
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY2),
key );
}
// Save third WEP key
if (isS60VersionGreaterThan3_1()) {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_HEX_WEP_KEY3),
key);
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY3),
key);
}
// Save fourth WEP key
if (isS60VersionGreaterThan3_1()) {
//TODO: wLanServiceTable->WriteTextL(TPtrC(NU_WLAN_WEP_KEY4),
// key);
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY4),
//.........这里部分代码省略.........