Ejemplo n.º 1
0
	for (i = 0; i < ARRAY_SIZE(g_table_locale_base); i++) {
		if (locale->valid_channels & (1 << i)) {
			wlc_locale_add_channels(channels,
						g_table_locale_base[i]);
		}
	}
}

/*
 * Locale Definitions - 2.4 GHz
 */
static const locale_info_t locale_i = {	/* locale i. channel 1 - 13 */
	LOCALE_CHAN_01_11 | LOCALE_CHAN_12_13,
	LOCALE_RADAR_SET_NONE,
	LOCALE_RESTRICTED_SET_2G_SHORT,
	{QDB(19), QDB(19), QDB(19),
	 QDB(19), QDB(19), QDB(19)},
	{20, 20, 20, 0},
	WLC_EIRP
};

/*
 * Locale Definitions - 5 GHz
 */
static const locale_info_t locale_11 = {
	/* locale 11. channel 36 - 48, 52 - 64, 100 - 140, 149 - 165 */
	LOCALE_CHAN_36_64 | LOCALE_CHAN_100_140 | LOCALE_CHAN_149_165,
	LOCALE_RADAR_SET_1,
	LOCALE_RESTRICTED_NONE,
	{QDB(21), QDB(21), QDB(21), QDB(21), QDB(21)},
	{23, 23, 23, 30, 30},
Ejemplo n.º 2
0
void
wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
		       txpwr_limits_t *txpwr)
{
	struct wlc_info *wlc = wlc_cm->wlc;
	uint i;
	uint chan;
	int maxpwr;
	int delta;
	const country_info_t *country;
	struct wlcband *band;
	const locale_info_t *li;
	int conducted_max;
	int conducted_ofdm_max;
	const locale_mimo_info_t *li_mimo;
	int maxpwr20, maxpwr40;
	int maxpwr_idx;
	uint j;

	memset(txpwr, 0, sizeof(txpwr_limits_t));

	if (!wlc_valid_chanspec_db(wlc_cm, chanspec)) {
		country = wlc_country_lookup(wlc, wlc->autocountry_default);
		if (country == NULL)
			return;
	} else {
		country = wlc_cm->country;
	}

	chan = CHSPEC_CHANNEL(chanspec);
	band = wlc->bandstate[CHSPEC_WLCBANDUNIT(chanspec)];
	li = BAND_5G(band->bandtype) ?
	    wlc_get_locale_5g(country->locale_5G) :
	    wlc_get_locale_2g(country->locale_2G);

	li_mimo = BAND_5G(band->bandtype) ?
	    wlc_get_mimo_5g(country->locale_mimo_5G) :
	    wlc_get_mimo_2g(country->locale_mimo_2G);

	if (li->flags & WLC_EIRP) {
		delta = band->antgain;
	} else {
		delta = 0;
		if (band->antgain > QDB(6))
			delta = band->antgain - QDB(6);	/* Excess over 6 dB */
	}

	if (li == &locale_i) {
		conducted_max = QDB(22);
		conducted_ofdm_max = QDB(22);
	}

	/* CCK txpwr limits for 2.4G band */
	if (BAND_2G(band->bandtype)) {
		maxpwr = li->maxpwr[CHANNEL_POWER_IDX_2G_CCK(chan)];

		maxpwr = maxpwr - delta;
		maxpwr = max(maxpwr, 0);
		maxpwr = min(maxpwr, conducted_max);

		for (i = 0; i < WLC_NUM_RATES_CCK; i++)
			txpwr->cck[i] = (u8) maxpwr;
	}

	/* OFDM txpwr limits for 2.4G or 5G bands */
	if (BAND_2G(band->bandtype)) {
		maxpwr = li->maxpwr[CHANNEL_POWER_IDX_2G_OFDM(chan)];

	} else {
		maxpwr = li->maxpwr[CHANNEL_POWER_IDX_5G(chan)];
	}

	maxpwr = maxpwr - delta;
	maxpwr = max(maxpwr, 0);
	maxpwr = min(maxpwr, conducted_ofdm_max);

	/* Keep OFDM lmit below CCK limit */
	if (BAND_2G(band->bandtype))
		maxpwr = min_t(int, maxpwr, txpwr->cck[0]);

	for (i = 0; i < WLC_NUM_RATES_OFDM; i++) {
		txpwr->ofdm[i] = (u8) maxpwr;
	}

	for (i = 0; i < WLC_NUM_RATES_OFDM; i++) {
		/* OFDM 40 MHz SISO has the same power as the corresponding MCS0-7 rate unless
		 * overriden by the locale specific code. We set this value to 0 as a
		 * flag (presumably 0 dBm isn't a possibility) and then copy the MCS0-7 value
		 * to the 40 MHz value if it wasn't explicitly set.
		 */
		txpwr->ofdm_40_siso[i] = 0;

		txpwr->ofdm_cdd[i] = (u8) maxpwr;

		txpwr->ofdm_40_cdd[i] = 0;
	}

	/* MIMO/HT specific limits */
	if (li_mimo->flags & WLC_EIRP) {
		delta = band->antgain;
	} else {
		delta = 0;
		if (band->antgain > QDB(6))
			delta = band->antgain - QDB(6);	/* Excess over 6 dB */
	}

	if (BAND_2G(band->bandtype))
		maxpwr_idx = (chan - 1);
	else
		maxpwr_idx = CHANNEL_POWER_IDX_5G(chan);

	maxpwr20 = li_mimo->maxpwr20[maxpwr_idx];
	maxpwr40 = li_mimo->maxpwr40[maxpwr_idx];

	maxpwr20 = maxpwr20 - delta;
	maxpwr20 = max(maxpwr20, 0);
	maxpwr40 = maxpwr40 - delta;
	maxpwr40 = max(maxpwr40, 0);

	/* Fill in the MCS 0-7 (SISO) rates */
	for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) {

		/* 20 MHz has the same power as the corresponding OFDM rate unless
		 * overriden by the locale specific code.
		 */
		txpwr->mcs_20_siso[i] = txpwr->ofdm[i];
		txpwr->mcs_40_siso[i] = 0;
	}

	/* Fill in the MCS 0-7 CDD rates */
	for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) {
		txpwr->mcs_20_cdd[i] = (u8) maxpwr20;
		txpwr->mcs_40_cdd[i] = (u8) maxpwr40;
	}

	/* These locales have SISO expressed in the table and override CDD later */
	if (li_mimo == &locale_bn) {
		if (li_mimo == &locale_bn) {
			maxpwr20 = QDB(16);
			maxpwr40 = 0;

			if (chan >= 3 && chan <= 11) {
				maxpwr40 = QDB(16);
			}
		}

		for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) {
			txpwr->mcs_20_siso[i] = (u8) maxpwr20;
			txpwr->mcs_40_siso[i] = (u8) maxpwr40;
		}
	}

	/* Fill in the MCS 0-7 STBC rates */
	for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) {
		txpwr->mcs_20_stbc[i] = 0;
		txpwr->mcs_40_stbc[i] = 0;
	}

	/* Fill in the MCS 8-15 SDM rates */
	for (i = 0; i < WLC_NUM_RATES_MCS_2_STREAM; i++) {
		txpwr->mcs_20_mimo[i] = (u8) maxpwr20;
		txpwr->mcs_40_mimo[i] = (u8) maxpwr40;
	}

	/* Fill in MCS32 */
	txpwr->mcs32 = (u8) maxpwr40;

	for (i = 0, j = 0; i < WLC_NUM_RATES_OFDM; i++, j++) {
		if (txpwr->ofdm_40_cdd[i] == 0)
			txpwr->ofdm_40_cdd[i] = txpwr->mcs_40_cdd[j];
		if (i == 0) {
			i = i + 1;
			if (txpwr->ofdm_40_cdd[i] == 0)
				txpwr->ofdm_40_cdd[i] = txpwr->mcs_40_cdd[j];
		}
	}

	/* Copy the 40 MHZ MCS 0-7 CDD value to the 40 MHZ MCS 0-7 SISO value if it wasn't
	 * provided explicitly.
	 */

	for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) {
		if (txpwr->mcs_40_siso[i] == 0)
			txpwr->mcs_40_siso[i] = txpwr->mcs_40_cdd[i];
	}

	for (i = 0, j = 0; i < WLC_NUM_RATES_OFDM; i++, j++) {
		if (txpwr->ofdm_40_siso[i] == 0)
			txpwr->ofdm_40_siso[i] = txpwr->mcs_40_siso[j];
		if (i == 0) {
			i = i + 1;
			if (txpwr->ofdm_40_siso[i] == 0)
				txpwr->ofdm_40_siso[i] = txpwr->mcs_40_siso[j];
		}
	}

	/* Copy the 20 and 40 MHz MCS0-7 CDD values to the corresponding STBC values if they weren't
	 * provided explicitly.
	 */
	for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) {
		if (txpwr->mcs_20_stbc[i] == 0)
			txpwr->mcs_20_stbc[i] = txpwr->mcs_20_cdd[i];

		if (txpwr->mcs_40_stbc[i] == 0)
			txpwr->mcs_40_stbc[i] = txpwr->mcs_40_cdd[i];
	}

#ifdef POWER_DBG
	wlc_phy_txpower_limits_dump(txpwr);
#endif
	return;
}
Ejemplo n.º 3
0
int storeConnectNotice(ConnectNotice &cn)
{
    int retVal = 0;

    // Before we do anything else, make sure that the Customer's DSL
    // number is a full 10 digit number.
    if (strlen(cn.custCirc) != 10) return retVal;
    
    ADB     DB;

    char    tmpPhone[128];
    string  workStr;
    char    noteText[1024];
    
    
    // Some time functions.
    time_t  curTime;
    char    curTimeDate[1024];
    struct  timeval tv;
    // Get GMT
    gettimeofday(&tv, 0);
    curTime = tv.tv_sec;
    // Now, convert GMT into local time
    tm *t = localtime(&curTime);
    int theYear = t->tm_year + 1900;

    sprintf(curTimeDate, "%04d-%02d-%02d %02d:%02d:%02d",
            theYear, t->tm_mon+1, t->tm_mday,
            t->tm_hour, t->tm_min, t->tm_sec);

    // We need to turn the DSL phone number into something we can find
    // in the database using any phone number delimiter.
    strcpy(tmpPhone, "");
    workStr = cn.custCirc;
    strcat(tmpPhone, workStr.substr(0, 3).c_str());
    strcat(tmpPhone, "%%");
    strcat(tmpPhone, workStr.substr(3, 3).c_str());
    strcat(tmpPhone, "%%");
    strcat(tmpPhone, workStr.substr(6, 4).c_str());
    strcat(tmpPhone, "%%");

    //printf("select * from PhoneNumbers where PhoneNumber LIKE '%s'\n", tmpPhone);
    DB.query("select * from PhoneNumbers where PhoneNumber LIKE '%s'", tmpPhone);
    if (DB.rowCount) {
        DB.getrow();
        syslog(LOG_NOTICE, "Found a phone number match (CustID %s)\n", DB.curRow["RefID"]);
        cn.customerID = atol(DB.curRow["RefID"]);
        ADBTable    notesDB("Notes");
        notesDB.setValue("AutoNote",    1);
        notesDB.setValue("AddedBy",     "Auto");
        notesDB.setValue("NoteDate",    cn.noticeDate);
        notesDB.setValue("CustomerID",  DB.curRow["RefID"]);
        notesDB.setValue("NoteType",    "Qwest DSL");
        notesDB.setValue("Category",    cn.connType);
        notesDB.setValue("SubCategory", "Connect Notice");
        notesDB.setValue("Subject",     cn.connType);
        strcpy(noteText, "");
        strcat(noteText, "Action ");
        strcat(noteText, cn.connType);
        strcat(noteText, "\n");

        strcat(noteText, "Name ");
        strcat(noteText, cn.custName);
        strcat(noteText, "\n");
        
        strcat(noteText, "Addr1 ");
        strcat(noteText, cn.addr1);
        strcat(noteText, "\n");

        strcat(noteText, "Addr2 ");
        strcat(noteText, cn.addr2);
        strcat(noteText, "\n");

        strcat(noteText, "Addr3 ");
        strcat(noteText, cn.addr3);
        strcat(noteText, "\n");

        strcat(noteText, "Select ");
        strcat(noteText, cn.isSelect);
        strcat(noteText, "\n");

        strcat(noteText, "CBR Number ");
        strcat(noteText, cn.cbr);
        strcat(noteText, "\n");

        strcat(noteText, "DSL Phone ");
        strcat(noteText, cn.custCirc);
        strcat(noteText, "\n");

        strcat(noteText, "Blarg Circuit ");
        strcat(noteText, cn.hostCirc);
        strcat(noteText, "\n");

        strcat(noteText, "Due Date ");
        strcat(noteText, cn.dueDate);
        strcat(noteText, "\n");

        strcat(noteText, "Speed ");
        strcat(noteText, cn.speed);
        strcat(noteText, "\n");

        strcat(noteText, "VPI ");
        strcat(noteText, cn.vpi);
        strcat(noteText, "\n");

        strcat(noteText, "VCI ");
        strcat(noteText, cn.vci);
        strcat(noteText, "\n");

        notesDB.setValue("NoteText", noteText);
        notesDB.ins();

        retVal = 1;
    } else {
        // fprintf(stderr, "No matching phone numbers for '%s'\n", tmpPhone);
    }

    // Store it in the QwestDSLNotices table now.
    ADBTable    QDB("QwestDSLNotices");
    QDB.setValue("CustomerID",  cn.customerID);
    QDB.setValue("NoticeDate",  cn.noticeDate);
    QDB.setValue("Action",      cn.connType);
    QDB.setValue("Name",        cn.custName);
    QDB.setValue("Addr1",       cn.addr1);
    QDB.setValue("Addr2",       cn.addr2);
    QDB.setValue("Addr3",       cn.addr3);
    QDB.setValue("Select256",   cn.isSelect);
    QDB.setValue("CBR",         cn.cbr);
    QDB.setValue("DueDate",     cn.dueDate);
    QDB.setValue("DSLNumber",   cn.custCirc);
    QDB.setValue("BlargCircuit",cn.hostCirc);
    QDB.setValue("LineSpeed",   cn.speed);
    QDB.setValue("VPI",         cn.vpi);
    QDB.setValue("VCI",         cn.vci);
    QDB.ins();
    cn.noticeID = QDB.getLong("NoticeID");
    
    return retVal;
}