⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 counter.cpp

📁 如题 就是 这东西 为什么非要我 说到 20个 字 呢 看看这回 够 不
💻 CPP
字号:
// counter.cpp
//
// Copyright (c) 1999-2007 Symbian Software Ltd.  All rights reserved.
//
// $Change: 937687 $

// PROJECT HEADERS
#include "srvapi.h"
#include "counter.h"

_LIT(KCommonFormat1,"counter value: %d \n");

const TUint kDefaultMessageSlots = 4;

////////////////////////////////////////
//RCountServ
////////////////////////////////////////

EXPORT_C RCountServ::RCountServ()
    {
    }

// Connect to the  server - default number of message slots = 4
EXPORT_C TInt RCountServ::Connect()
    {
    TInt r = StartThread();
    if (r == KErrNone)
        r = CreateSession(KCountServerName, Version(), kDefaultMessageSlots);
    return(r); 
    }
    
// Return the client side version number.
EXPORT_C TVersion RCountServ::Version(void) const
    {
    return(TVersion(KCountServMajorVersionNumber,
                KCountServMinorVersionNumber,
                KCountServBuildVersionNumber));
    }

// increase the counter by the default (1)
EXPORT_C void RCountServ::Increase()
    {
    TIpcArgs args;
    
    SendReceive(ECountServIncrease, args);
    }

// increase the counter by an integer
EXPORT_C void RCountServ::IncreaseBy(TInt anInt)
    {
    SendReceive(ECountServIncreaseBy, TIpcArgs(anInt));
    }

// decrease the counter by the default (1)
EXPORT_C void RCountServ::Decrease()
    {
    SendReceive(ECountServDecrease, TIpcArgs());
    }

// decrease the counter by an integer
EXPORT_C void RCountServ::DecreaseBy(TInt anInt)
    {
    SendReceive(ECountServDecreaseBy, TIpcArgs(anInt));
    }

//reset the counter to 0
EXPORT_C void RCountServ::Reset()
    {
    SendReceive(ECountServReset, TIpcArgs());
    }

//get the server counter value
EXPORT_C TInt RCountServ::CounterValue()
    {
    TInt res = 0;
    
    TPckgBuf<TInt> pckg;
    TIpcArgs args(&pckg);
    
    SendReceive(ECountServValue, args);
    res = pckg();
    return res;
    }

EXPORT_C TInt RCountServ::Stop()
    {
    TIpcArgs args;

    return SendReceive(ECountServStop, args);
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -