void CGXDLMSPppSetup::GetAttributeIndexToRead(vector<int>& attributes)
{
	//LN is static and read only once.
	if (CGXOBISTemplate::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
	//PHYReference
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //LCPOptions
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //IPCPOptions
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
    //PPPAuthentication
    if (!IsRead(5))
    {
        attributes.push_back(5);
    }
}
Exemplo n.º 2
0
void CGXDLMSTcpUdpSetup::GetAttributeIndexToRead(std::vector<int>& attributes)
{
    //LN is static and read only once.
    if (CGXDLMSObject::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
    //Port
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //IPReference
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //MaximumSegmentSize
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
    //MaximumSimultaneousConnections
    if (!IsRead(5))
    {
        attributes.push_back(5);
    }
    //InactivityTimeout
    if (!IsRead(6))
    {
        attributes.push_back(6);
    }
}
void CGXDLMSMBusSlavePortSetup::GetAttributeIndexToRead(vector<int>& attributes)
{
	//LN is static and read only once.
	if (CGXOBISTemplate::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
	//DefaultBaud
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //AvailableBaud
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //m_AddressState
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
    //BusAddress
    if (!IsRead(5))
    {
        attributes.push_back(5);
    }
}
Exemplo n.º 4
0
void CGXDLMSAutoAnswer::GetAttributeIndexToRead(std::vector<int>& attributes)
{
    //LN is static and read only once.
    if (CGXDLMSObject::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
    //Mode is static and read only once.
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //ListeningWindow is static and read only once.
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //Status is not static.
    if (CanRead(4))
    {
        attributes.push_back(4);
    }

    //NumberOfCalls is static and read only once.
    if (!IsRead(5))
    {
        attributes.push_back(5);
    }
    //NumberOfRingsInListeningWindow is static and read only once.
    if (!IsRead(6))
    {
        attributes.push_back(6);
    }
}
Exemplo n.º 5
0
QVariant BookmarksModel::data (const QModelIndex& index, int role) const
{
    if (index.row () < 0 || index.row () > Bookmarks_.count ())
        return QVariant ();

    auto bookmark = Bookmarks_.at (index.row ());

    switch (role)
    {
    case BRID:
        return bookmark->GetID ();
    case BRUrl:
        return bookmark->GetUrl ();
    case BRTitle:
        return bookmark->GetTitle ();
    case BRDescription:
        return bookmark->GetDescription ();
    case BRImageUrl:
        return bookmark->GetImageUrl ();
    case BRFavorite:
        return bookmark->IsFavorite ();
    case BRRead:
        return bookmark->IsRead ();
    case BRTags:
        return bookmark->GetTags ().join (',');
    case BRAddTime:
        return bookmark->GetAddTime ();
    case BRUpdateTime:
        return bookmark->GetUpdateTime ();
    case BRStatus:
        return bookmark->GetStatus ();
    default:
        return QVariant ();
    }
}
nsresult nsNewsDatabase::SyncWithReadSet() {
  // The code below attempts to update the underlying nsMsgDatabase's idea
  // of read/unread flags to match the read set in the .newsrc file. It should
  // only be called when they don't match, e.g., we crashed after committing the
  // db but before writing out the .newsrc
  nsCOMPtr<nsISimpleEnumerator> hdrs;
  nsresult rv = EnumerateMessages(getter_AddRefs(hdrs));
  NS_ENSURE_SUCCESS(rv, rv);

  bool hasMore = false, readInNewsrc, isReadInDB, changed = false;
  int32_t numMessages = 0, numUnreadMessages = 0;
  nsMsgKey messageKey;
  nsCOMPtr<nsIMsgThread> threadHdr;

  // Scan all messages in DB
  while (NS_SUCCEEDED(rv = hdrs->HasMoreElements(&hasMore)) && hasMore) {
    nsCOMPtr<nsISupports> supports;
    rv = hdrs->GetNext(getter_AddRefs(supports));
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIMsgDBHdr> header = do_QueryInterface(supports, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    rv = nsMsgDatabase::IsHeaderRead(header, &isReadInDB);
    NS_ENSURE_SUCCESS(rv, rv);

    header->GetMessageKey(&messageKey);
    IsRead(messageKey, &readInNewsrc);

    numMessages++;
    if (!readInNewsrc) numUnreadMessages++;

    // If DB and readSet disagree on Read/Unread, fix DB
    if (readInNewsrc != isReadInDB) {
      MarkHdrRead(header, readInNewsrc, nullptr);
      changed = true;
    }
  }

  // Update FolderInfo Counters
  int32_t oldMessages, oldUnreadMessages;
  rv = m_dbFolderInfo->GetNumMessages(&oldMessages);
  if (NS_SUCCEEDED(rv) && oldMessages != numMessages) {
    changed = true;
    m_dbFolderInfo->ChangeNumMessages(numMessages - oldMessages);
  }
  rv = m_dbFolderInfo->GetNumUnreadMessages(&oldUnreadMessages);
  if (NS_SUCCEEDED(rv) && oldUnreadMessages != numUnreadMessages) {
    changed = true;
    m_dbFolderInfo->ChangeNumUnreadMessages(numUnreadMessages -
                                            oldUnreadMessages);
  }

  if (changed) Commit(nsMsgDBCommitType::kLargeCommit);

  return rv;
}
Exemplo n.º 7
0
void BookmarksModel::AddBookmarks (const Bookmarks_t& bookmarks)
{
    Bookmarks_t bmss = bookmarks;
    for (int i = bmss.count () - 1; i >= 0; --i)
    {
        auto bms = bmss.at (i);
        auto it = std::find_if (Bookmarks_.begin (), Bookmarks_.end (),
                                [bms] (decltype (Bookmarks_.front ()) bookmark)
        {
            return bms->GetID () == bookmark->GetID ();
        });
        if (it != Bookmarks_.end ())
        {
            const int pos = std::distance (Bookmarks_.begin (), it);
            switch (bms->GetStatus ())
            {
            case Bookmark::SDeleted:
                RemoveBookmark (bms->GetID ());
                break;
            case Bookmark::SArchived:
            {
                Bookmark *bm = Bookmarks_ [pos];
                bm->SetIsRead (true);

                emit dataChanged (index (pos), index (pos));

                break;
            }
            default:
            {
                Bookmark *bm = Bookmarks_ [pos];
                bm->SetUrl (bms->GetUrl ());
                bm->SetTitle (bms->GetTitle ());
                bm->SetDescription (bms->GetDescription ());
                bm->SetIsFavorite (bms->IsFavorite ());
                bm->SetIsRead (bms->IsRead ());
                bm->SetAddTime (bms->GetAddTime ());
                bm->SetUpdateTime (bms->GetUpdateTime ());
                bm->SetTags (bms->GetTags ());
                bm->SetImageUrl (bms->GetImageUrl ());
                bm->SetStatus (bms->GetStatus ());

                emit dataChanged (index (pos), index (pos));

                break;
            }
            }

            bmss.takeAt (i)->deleteLater ();
        }
    }

    beginInsertRows (QModelIndex (), rowCount (),
                     rowCount () + bmss.count () - 1);
    Bookmarks_.append (bmss);
    endInsertRows ();
}
nsresult nsNewsDatabase::IsHeaderRead(nsIMsgDBHdr *msgHdr, bool *pRead) {
  nsresult rv;
  nsMsgKey messageKey;

  if (!msgHdr || !pRead) return NS_ERROR_NULL_POINTER;

  rv = msgHdr->GetMessageKey(&messageKey);
  if (NS_FAILED(rv)) return rv;

  rv = IsRead(messageKey, pRead);
  return rv;
}
Exemplo n.º 9
0
void CGXDLMSIecHdlcSetup::GetAttributeIndexToRead(std::vector<int>& attributes)
{
    //LN is static and read only once.
    if (CGXDLMSObject::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
    //CommunicationSpeed
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //WindowSizeTransmit
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //WindowSizeReceive
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
    //MaximumInfoLengthTransmit
    if (!IsRead(5))
    {
        attributes.push_back(5);
    }
    //MaximumInfoLengthReceive
    if (!IsRead(6))
    {
        attributes.push_back(6);
    }
    //InterCharachterTimeout
    if (!IsRead(7))
    {
        attributes.push_back(7);
    }
    //InactivityTimeout
    if (!IsRead(8))
    {
        attributes.push_back(8);
    }
    //DeviceAddress
    if (!IsRead(9))
    {
        attributes.push_back(9);
    }
}
void CGXDLMSAssociationLogicalName::GetAttributeIndexToRead(vector<int>& attributes)
{
    //LN is static and read only once.
	if (CGXOBISTemplate::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
    //ObjectList is static and read only once.
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //associated_partners_id is static and read only once.
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //Application Context Name is static and read only once.
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
    //xDLMS Context Info
    if (!IsRead(5))
    {
        attributes.push_back(5);
    }
    // Authentication Mechanism Name
    if (!IsRead(6))
    {
        attributes.push_back(6);
    }
    // Secret
    if (!IsRead(7))
    {
        attributes.push_back(7);
    }
    // Association Status
    if (!IsRead(8))
    {
        attributes.push_back(8);
    }
    //Security Setup Reference is from version 1.
    if (GetVersion() > 0 && !IsRead(9))
    {
        attributes.push_back(9);
    }    
}
void CGXDLMSModemConfiguration::GetAttributeIndexToRead(vector<int>& attributes)
{
	//LN is static and read only once.
	if (CGXOBISTemplate::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
	//CommunicationSpeed
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //InitialisationStrings
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //ModemProfile
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
}
Exemplo n.º 12
0
void CGXDLMSGPRSSetup::GetAttributeIndexToRead(std::vector<int>& attributes)
{
    //LN is static and read only once.
    if (CGXDLMSObject::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
    //APN
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //PINCode
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //DefaultQualityOfService + RequestedQualityOfService
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
}
void CGXDLMSActionSchedule::GetAttributeIndexToRead(vector<int>& attributes)
{
	//LN is static and read only once.
	if (CGXOBISTemplate::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
	//ExecutedScriptLogicalName is static and read only once.
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //Type is static and read only once.
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //ExecutionTime is static and read only once.
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
}
void CGXDLMSExtendedRegister::GetAttributeIndexToRead(vector<int>& attributes)
{
	CGXDLMSRegister::GetAttributeIndexToRead(attributes);
	//Status
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
    //CaptureTime
    if (CanRead(5))
    {
        attributes.push_back(5);
    }
}
void CGXDLMSAssociationShortName::GetAttributeIndexToRead(vector<int>& attributes)
{
	//LN is static and read only once.
	if (CGXOBISTemplate::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
	//ObjectList is static and read only once.
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //AccessRightsList is static and read only once.
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //SecuritySetupReference is static and read only once.
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
}
void CGXDLMSDemandRegister::GetAttributeIndexToRead(vector<int>& attributes)
{
	//LN is static and read only once.
	if (CGXOBISTemplate::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
	//ScalerUnit
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
    //CurrentAvarageValue
    if (CanRead(2))
    {
        attributes.push_back(2);
    }
    //LastAvarageValue            
    if (CanRead(3))
    {
        attributes.push_back(3);
    }        
    //Status
    if (CanRead(5))
    {
        attributes.push_back(5);
    }
    //CaptureTime
    if (CanRead(6))
    {
        attributes.push_back(6);
    }
    //StartTimeCurrent
    if (CanRead(7))
    {
        attributes.push_back(7);
    }
    //Period
    if (CanRead(8))
    {
        attributes.push_back(8);
    }
    //NumberOfPeriods
    if (CanRead(9))
    {
        attributes.push_back(9);
    }
}
Exemplo n.º 17
0
void CGXDLMSRegister::GetAttributeIndexToRead(std::vector<int>& attributes)
{
    //LN is static and read only once.
    if (CGXDLMSObject::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
    //ScalerUnit
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //Value
    if (CanRead(2))
    {
        attributes.push_back(2);
    }
}
void CGXDLMSProfileGeneric::GetAttributeIndexToRead(vector<int>& attributes)
{
    //LN is static and read only once.
	if (CGXOBISTemplate::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
    //Buffer
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //CaptureObjects
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //CapturePeriod
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
    //SortMethod
    if (!IsRead(5))
    {
        attributes.push_back(5);
    }
    //SortObject
    if (!IsRead(6))
    {
        attributes.push_back(6);
    }
    //EntriesInUse
    if (!IsRead(7))
    {
        attributes.push_back(7);
    }
    //ProfileEntries
    if (!IsRead(8))
    {
        attributes.push_back(8);
    }        
}
Exemplo n.º 19
0
void CGXDLMSImageTransfer::GetAttributeIndexToRead(std::vector<int>& attributes)
{
    //LN is static and read only once.
    if (CGXDLMSObject::IsLogicalNameEmpty(m_LN))
    {
        attributes.push_back(1);
    }
    //ImageBlockSize
    if (!IsRead(2))
    {
        attributes.push_back(2);
    }
    //ImageTransferredBlocksStatus
    if (!IsRead(3))
    {
        attributes.push_back(3);
    }
    //ImageFirstNotTransferredBlockNumber
    if (!IsRead(4))
    {
        attributes.push_back(4);
    }
    //ImageTransferEnabled
    if (!IsRead(5))
    {
        attributes.push_back(5);
    }
    //ImageTransferStatus
    if (!IsRead(6))
    {
        attributes.push_back(6);
    }
    //ImageActivateInfo
    if (!IsRead(7))
    {
        attributes.push_back(7);
    }
}
Exemplo n.º 20
0
bool KeyspaceClientReq::IsWrite()
{
	return !IsRead();
}