当前位置: 首页>>代码示例>>C++>>正文


C++ setByte函数代码示例

本文整理汇总了C++中setByte函数的典型用法代码示例。如果您正苦于以下问题:C++ setByte函数的具体用法?C++ setByte怎么用?C++ setByte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setByte函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FindContact

MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary)
{
	MCONTACT hContact = FindContact(skypename);

	if (!hContact)
	{
		hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
		Proto_AddToContact(hContact, m_szModuleName);

		setString(hContact, SKYPE_SETTINGS_ID, skypename);

		DBVARIANT dbv;
		if (!getTString(SKYPE_SETTINGS_GROUP, &dbv))
		{
			db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
			db_free(&dbv);
		}

		setByte(hContact, "Auth", 1);
		setByte(hContact, "Grant", 1);

		if (isTemporary)
			db_set_b(hContact, "CList", "NotOnList", 1);
	}
	return hContact;
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:26,代码来源:skype_contacts.cpp

示例2: setByte

bool AD5933_Class::setStepSizeInHex(long freqHex) {

	if (freqHex > 0xFFFFFF)
	{
#if LOGGING1
		printer->print("setIncrementHex - Freqeuncy Overflow!");
#endif
		return false;
	}

	int lowerHex = freqHex % 256;
	int midHex = ((freqHex - (long)lowerHex) >> 8) % 256;
	int upperHex = freqHex >> 16;

	bool t2, t3, t4;
	t2 = setByte(0x85, upperHex);
	t3 = setByte(0x86, midHex);
	t4 = setByte(0x87, lowerHex);
	if (t2 && t3 && t4)
	{
		incrHex = freqHex;
		return true; // Succeed!
	}
	else
	{
#if LOGGING1
		printer->println("setIncrementHex - Data Transmission Failed!");
#endif
		return false;
	}

}
开发者ID:m4loman,项目名称:Impalyzer,代码行数:32,代码来源:AD5933.cpp

示例3: setByte

bool AD5933_Class::setIncrementinHex(long freqHex)
// Function to set increment frequency in converted Hex value. (calculated based on the datasheet.)
// long freqHex - converted hexadecimal value
{
	if (freqHex > 0xFFFFFF)
	{
#if LOGGING1
		printer->print("setIncrementHex - Freqeuncy Overflow!");
#endif
		return false;
	}

	int lowerHex = freqHex % 256;
	int midHex = ((freqHex - (long)lowerHex) >> 8) % 256;
	int upperHex = freqHex >> 16;

	bool t2, t3, t4;
	t2 = setByte(0x85, upperHex);
	t3 = setByte(0x86, midHex);
	t4 = setByte(0x87, lowerHex);
	if (t2 && t3 && t4)
	{
		incrHex = freqHex;
		return true; // Succeed!
	}
	else
	{
#if LOGGING1
		printer->println("setIncrementHex - Data Transmission Failed!");
#endif
		return false;
	}

}
开发者ID:HugoSBIO,项目名称:drive,代码行数:34,代码来源:AD5933.cpp

示例4: MessageBox

INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam)
{
	TCHAR *szFilename = (TCHAR*)lParam;

	if (!getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS))
		return -2;

	if (szFilename == NULL) {
		MessageBox(NULL, 
			TranslateT("To remove your Gadu-Gadu avatar, you must use the gg.pl website."),
			m_tszUserName, MB_OK | MB_ICONINFORMATION);
		return -1;
	}

	int iAvType = ProtoGetAvatarFormat(szFilename);
	if ( iAvType == PA_FORMAT_UNKNOWN) {
		debugLogA("setmyavatar(): Failed to set user avatar. File %s has incompatible extension.", szFilename);
		return -1;
	}

	setByte(GG_KEY_AVATARTYPEPREV, getByte(GG_KEY_AVATARTYPE, -1));
	setByte(GG_KEY_AVATARTYPE, (BYTE)iAvType);

	TCHAR szMyFilename[MAX_PATH];
	getAvatarFilename(NULL, szMyFilename, _countof(szMyFilename));
	if ( mir_tstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
		debugLogA("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
		return -1;
	}

	setAvatar(szMyFilename);
	return 0;
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:33,代码来源:services.cpp

示例5: CSOptionsProc

INT_PTR CALLBACK CSOptionsProc(HWND hwnd, UINT message, WPARAM, LPARAM lparam)
{
	switch (message) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwnd);
		CheckDlgButton(hwnd, IDC_CONFIRM_DELETION,
			getByte("ConfirmDeletion", DEFAULT_PLUGIN_CONFIRM_ITEMS_DELETION) ?
			BST_CHECKED : BST_UNCHECKED);

		CheckDlgButton(hwnd, IDC_DELETE_AFTER_IMPORT,
			getByte("DeleteAfterImport", DEFAULT_PLUGIN_DELETE_AFTER_IMPORT) ?
			BST_CHECKED : BST_UNCHECKED);

		CheckDlgButton(hwnd, IDC_REMEMBER_POSITION,
			getByte("RememberWindowPosition", DEFAULT_REMEMBER_WINDOW_POSITION) ?
			BST_CHECKED : BST_UNCHECKED);
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lparam)->code) {
		case PSN_APPLY:
			setByte("ConfirmDeletion", IsDlgButtonChecked(hwnd, IDC_CONFIRM_DELETION) ? 1 : 0);
			setByte("DeleteAfterImport", IsDlgButtonChecked(hwnd, IDC_DELETE_AFTER_IMPORT) ? 1 : 0);
			setByte("RememberWindowPosition", IsDlgButtonChecked(hwnd, IDC_REMEMBER_POSITION) ? 1 : 0);

			Menu_ReloadProtoMenus();
			break;
		}
		return TRUE;
	}
	return FALSE;
}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:32,代码来源:cslist.cpp

示例6: mir_snprintf

void CSItemsList::saveItems(char *protoName)
{
	unsigned int i;
	char dbSetting[32];
	mir_snprintf(dbSetting, "%s_ItemsCount", protoName);
	unsigned int oldItemsCount = getWord(dbSetting, DEFAULT_ITEMS_COUNT);

	for (i = 1; i <= m_list->getCount(); i++)
	{
		StatusItem* item = m_list->get(i - 1);
		mir_snprintf(dbSetting, "%s_Item%dIcon", protoName, i);
		setByte(dbSetting, item->m_iIcon);
		mir_snprintf(dbSetting, "%s_Item%dTitle", protoName, i);
		setWString(dbSetting, item->m_tszTitle);
		mir_snprintf(dbSetting, "%s_Item%dMessage", protoName, i);
		setWString(dbSetting, item->m_tszMessage);
		mir_snprintf(dbSetting, "%s_Item%dFavourite", protoName, i);
		setByte(dbSetting, item->m_bFavourite);
	}

	mir_snprintf(dbSetting, "%s_ItemsCount", protoName);
	setWord(dbSetting, m_list->getCount());

	for (; i <= oldItemsCount; i++)
	{
		mir_snprintf(dbSetting, "%s_Item%dIcon", protoName, i);
		deleteSetting(dbSetting);
		mir_snprintf(dbSetting, "%s_Item%dTitle", protoName, i);
		deleteSetting(dbSetting);
		mir_snprintf(dbSetting, "%s_Item%dMessage", protoName, i);
		deleteSetting(dbSetting);
		mir_snprintf(dbSetting, "%s_Item%dFavourite", protoName, i);
		deleteSetting(dbSetting);
	}
}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:35,代码来源:cslist.cpp

示例7: setShort

void setShort(byte* array, int& position, unsigned short value, int length) {
    byte* bvalue = (byte*) &value;
    if(length > 8) {
        byte filled = length - 8;
        setByte(array, position, bvalue[1], filled);
        length = 8;
    }
    setByte(array, position, bvalue[0], length);
}
开发者ID:kylemcdonald,项目名称:oelf,代码行数:9,代码来源:Shared.cpp

示例8: debugLogA

void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
	debugLogA("CVkProto::OnReceiveUserInfo %d", reply->resultCode);
	if (reply->resultCode != 200)
		return;

	JSONROOT pRoot;
	JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot);
	if (pResponse == NULL)
		return;

	for (size_t i=0; ; i++) {
		JSONNODE *pRecord = json_at(pResponse, i);
		if (pRecord == NULL) break;

		LONG userid = json_as_int( json_get(pRecord, "uid"));
		if (userid == 0)
			return;

		MCONTACT hContact;
		if (userid == m_myUserId)
			hContact = NULL;
		else if ((hContact = FindUser(userid, false)) == NULL)
			return;

		CMString tszNick;
		ptrT szValue( json_as_string( json_get(pRecord, "first_name")));
		if (szValue) {
			setTString(hContact, "FirstName", szValue);
			tszNick.Append(szValue);
			tszNick.AppendChar(' ');
		}

		if (szValue = json_as_string( json_get(pRecord, "last_name"))) {
			setTString(hContact, "LastName", szValue);
			tszNick.Append(szValue);
		}

		if (!tszNick.IsEmpty())
			setTString(hContact, "Nick", tszNick);
	
		setByte(hContact, "Gender", json_as_int( json_get(pRecord, "sex")) == 2 ? 'M' : 'F');
	
		if (szValue = json_as_string( json_get(pRecord, "bdate"))) {
			int d, m, y;
			if ( _stscanf(szValue, _T("%d.%d.%d"), &d, &m, &y) == 3) {
				setByte(hContact, "BirthDay", d);
				setByte(hContact, "BirthMonth", m);
				setWord(hContact, "BirthYear", y);
			}
		}

		szValue = json_as_string( json_get(pRecord, "photo_medium"));
		SetAvatarUrl(hContact, szValue);
	}
}
开发者ID:Ganster41,项目名称:miranda-ng,代码行数:56,代码来源:vk_thread.cpp

示例9: debugLogA

void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
	debugLogA("CVkProto::OnReceiveFriends %d", reply->resultCode);
	if (reply->resultCode != 200 || !IsOnline())
		return;

	JSONNode jnRoot;
	const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
	if (!jnResponse)
		return;
	
	CVkSendMsgParam *param = (CVkSendMsgParam *)pReq->pUserInfo;
	bool bCleanContacts = getBool("AutoClean") || (param->iMsgID != 0);
	delete param;

	LIST<void> arContacts(10, PtrKeySortT);
		
	for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
		if (!isChatRoom(hContact))
			setByte(hContact, "Auth", 1);
		db_unset(hContact, m_szModuleName, "ReqAuth");
		SetMirVer(hContact, -1);
		if (bCleanContacts && !isChatRoom(hContact))
			arContacts.insert((HANDLE)hContact);
	}

	const JSONNode &jnItems = jnResponse["items"];

	if (jnItems)
		for (auto it = jnItems.begin(); it != jnItems.end(); ++it) {
			MCONTACT hContact = SetContactInfo((*it), true);

			if (hContact == NULL || hContact == INVALID_CONTACT_ID)
				continue;

			arContacts.remove((HANDLE)hContact);
			setByte(hContact, "Auth", 0);
		}

	if (bCleanContacts)
		for (int i = 0; i < arContacts.getCount(); i++) {
			MCONTACT hContact = (UINT_PTR)arContacts[i];
			LONG userID = getDword(hContact, "ID", -1);
			if (userID == m_myUserId || userID == VK_FEED_USER)
				continue;
			CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact);
		}
	
	arContacts.destroy();
}
开发者ID:gloria8023,项目名称:miranda-ng,代码行数:50,代码来源:vk_thread.cpp

示例10: switch

void CJabberProto::UpdateSubscriptionInfo(MCONTACT hContact, JABBER_LIST_ITEM *item)
{
	switch (item->subscription) {
	case SUB_TO:
		setTString(hContact, "SubscriptionText", TranslateT("To"));
		setString(hContact, "Subscription", "to");
		setByte(hContact, "Auth", 0);
		setByte(hContact, "Grant", 1);
		break;
	case SUB_FROM:
		setTString(hContact, "SubscriptionText", TranslateT("From"));
		setString(hContact, "Subscription", "from");
		setByte(hContact, "Auth", 1);
		setByte(hContact, "Grant", 0);
		break;
	case SUB_BOTH:
		setTString(hContact, "SubscriptionText", TranslateT("Both"));
		setString(hContact, "Subscription", "both");
		setByte(hContact, "Auth", 0);
		setByte(hContact, "Grant", 0);
		break;
	case SUB_NONE:
		setTString(hContact, "SubscriptionText", TranslateT("None"));
		setString(hContact, "Subscription", "none");
		setByte(hContact, "Auth", 1);
		setByte(hContact, "Grant", 1);
		break;
	}
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:29,代码来源:jabber_misc.cpp

示例11: TM1638_map_char

void TM1638::setChar(const uint8_t pos, const char value)
{
    const uint8_t b = TM1638_map_char(value);
    if (b)
        setByte(pos, b);

    else if (value >= 'a' && value <= 'z')
        setByte(pos, pgm_read_byte(&TM_DIGITS[value - 'a' + 10]));

    else if (value >= 'A' && value <= 'Z')
        setByte(pos, pgm_read_byte(&TM_DIGITS[value - 'A' + 10]));

    else if (value >= '0' && value <= '9')
        setByte(pos, pgm_read_byte(&TM_DIGITS[value - '0']));
}
开发者ID:JDTucker-5696,项目名称:TM1638,代码行数:15,代码来源:tm1638.cpp

示例12: setByte

void setByte(byte* array, int& position, byte value, int length) {
    // nothing to copy
    if(length == 0)
        return;

    // for 0-padded bitstrings stored as bytes
    if(length > 8) {
        int extra = length - 8;
        setByte(array, position, 0, extra);
        length -= extra;
    }

    // get byte and bit offset
    unsigned int whichByte = position >> 3;
    byte whichBit = position - (whichByte << 3);

    // handle the left hand side if it crosses a boundary
    byte shift, mask;
    if(whichBit + length > 8) {
        shift = whichBit + length - 8;
        byte shifted = value;
        shifted >>= shift;
        byte filled = 8 - whichBit;
        byte mask = ((1 << filled) - 1);
        array[whichByte] = combine(shifted, array[whichByte], mask);
        position += filled;
        length -= filled;
        whichByte++;
        whichBit = 0;
    }
开发者ID:kylemcdonald,项目名称:oelf,代码行数:30,代码来源:Shared.cpp

示例13: GetChatRoom

MCONTACT CToxProto::AddChatRoom(int groupNumber)
{
	MCONTACT hContact = GetChatRoom(groupNumber);
	if (!hContact)
	{
		hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
		Proto_AddToContact(hContact, m_szModuleName);

		setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber);

		TCHAR title[MAX_PATH];
		mir_sntprintf(title, _T("%s #%d"), TranslateT("Group chat"), groupNumber);
		setTString(hContact, "Nick", title);

		DBVARIANT dbv;
		if (!db_get_s(NULL, "Chat", "AddToGroup", &dbv, DBVT_TCHAR))
		{
			db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
			db_free(&dbv);
		}

		setByte(hContact, "ChatRoom", 1);
	}
	return hContact;
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:25,代码来源:tox_chatrooms.cpp

示例14: getSetting

void CAimProto::avatar_request_handler(HANDLE hContact, char* hash, unsigned char type)//checks to see if the avatar needs requested
{
	if (hContact == NULL)
	{
		hash = hash_lg ? hash_lg : hash_sm;
		type = hash_lg ? 12 : 1;
	}

	char* saved_hash = getSetting(hContact, AIM_KEY_AH);
	if (hash && _stricmp(hash, "0201d20472") && _stricmp(hash, "2b00003341")) //gaim default icon fix- we don't want their blank icon displaying.
	{
		if (_strcmps(saved_hash, hash))
		{
			setByte(hContact, AIM_KEY_AHT, type);
			setString(hContact, AIM_KEY_AH, hash);

			sendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
		}
	}
	else
	{
		if (saved_hash)
		{
			deleteSetting(hContact, AIM_KEY_AHT);
			deleteSetting(hContact, AIM_KEY_AH);

			sendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
		}
	}
	mir_free(saved_hash);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:31,代码来源:avatars.cpp

示例15: MMMessage

UTDigital::UTDigital( void ) {
  int byte;

  MMMessage( "Initializing Digital IO components..." );

  // Set the MPC550 Digital IO directions 
  //   Port A - output,  Port B - input
  //   Port C  bits 0-3 output
  //   Port C  bits 4-7 input */
  MPC550Card->setDIODir( true, false, false, true);

  // Set all the DM6814 digital channels to input
  DM6814Card[0]->setDIODir( 0, false, false );
  DM6814Card[0]->setDIODir( 1, false, false );
  DM6814Card[0]->setDIODir( 2, false, false );
  DM6814Card[1]->setDIODir( 0, false, false );
  DM6814Card[1]->setDIODir( 1, false, false );
  DM6814Card[1]->setDIODir( 2, false, false );

  // Reset all the digital outputs
  for ( byte = 0; byte < 9; byte++ ) {
    setByte( byte, 0x00 );
  }

  MMMessage( "done.\n" );
}
开发者ID:kiik,项目名称:RHexLib,代码行数:26,代码来源:UTDigital.cpp


注:本文中的setByte函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。