Пример #1
0
std::string ProtocolYidong::getStringForMethod(int method, unsigned char, Controller *) {
	int intCode = this->getIntParameter(L"unit", 1, 4);
	std::wstring strCode = L"111";

	switch(intCode) {
	case 1:
		strCode.append(L"0010");
		break;
	case 2:
		strCode.append(L"0001");
		break;
	case 3:
		strCode.append(L"0100");
		break;
	case 4:
		strCode.append(L"1000");
		break;
	}

	strCode.append(L"110");
	return getStringForCode(strCode, method);
}
Пример #2
0
char * getStringForCode(Tree *dic, int code, char *string) {
    Tree current = *dic;
    if (code <= 256) {
        free(string);
        string = malloc(2);
        string[0] = code;
        string[1] = '\0';
        return string;
    }
    if (current -> code == code) {
        return string;
    }
    for(int a = 0; current -> children[a]; a++) {
        char letter = current -> childChar[a];
        char *newString = newStringForLetterString(string, letter);
        char *outputString = getStringForCode(&current -> children[a], code, newString);
        if (outputString) {
            free(string);
            return outputString;
        }
    }
    free(string);
    return NULL;
}
Пример #3
0
std::string ProtocolSartano::getStringForMethod(int method, unsigned char, Controller *) {
	std::wstring strCode = this->getStringParameter(L"code", L"");
	return getStringForCode(strCode, method);
}