void rsi_initialize_ipconfig_parmas(ipconfig_t *ipConfig) { if (NETWORKTYPE != IBSS) ipConfig->DHCP = DHCP_MODE; else ipConfig->DHCP = DISABLE; if (ipConfig->DHCP == DISABLE) { /* ip address to be configured */ rsi_memcpy(ipConfig->uIPaddr, device_ip, 4); /* subnet mask to be configured */ rsi_memcpy(ipConfig->uSubnet, subnet_mask, 4); /* Default gateway to be configured */ rsi_memcpy(ipConfig->uDefaultGateway, gateway, 4); } }
void rsi_initialize_netwrok_config1(networkConfig_t *networkConfig) { /* socket type */ networkConfig->uSocketType = SOCKET_LTCP; /* Local port number */ networkConfig->stLocalPort = 800; /* Remote port number */ networkConfig->remote_address.sinPort = 2054; /* Remote ip address */ rsi_memcpy(networkConfig->remote_address.ip, remote_ip, 4); }
uint16_t rsi_prepare_pkt_to_send(uint16_t type, uint16_t val, uint8_t *buff) { uint16_t index = 0; uint16_t count = 0; uint16_t len = 0; uint16_t rssi_val = 0; struct WiFi_CNFG_ScanInfo stScanInfo; buff[index++] = (uint8_t)type; switch (type) { case WIFI_CONFIG_ACK: case THROUGHPUT: /* Throughput */ case POWER_CONSUMPTION: /* Power consumption */ case RSSI: /* Recieved Signal Strength */ { rsi_memcpy((buff + index), &val, 2); index += 2; } break; case SSID_LIST: /* Prepare the SSID list */ { /* Get the APs List */ ScanRsp = &Adaptor.ScanRsp; // move connected AP to first location for (count = 0; count < ScanRsp->uScanCount; count++) { if (!(strcmp((const char*)ScanRsp->stScanInfo[count].uSSID, (const char*)join_info->uSSID))) { if (count != 0) { rsi_memcpy(&stScanInfo,&ScanRsp->stScanInfo[count], sizeof(struct WiFi_CNFG_ScanInfo)); rsi_memcpy(&ScanRsp->stScanInfo[count],&ScanRsp->stScanInfo[0], sizeof(struct WiFi_CNFG_ScanInfo)); rsi_memcpy(&ScanRsp->stScanInfo[0],&stScanInfo, sizeof(struct WiFi_CNFG_ScanInfo)); } } } count = 0; while (count < ScanRsp->uScanCount) { len = rs22_strlen(ScanRsp->stScanInfo[count].uSSID); if (len > 0) { rsi_memcpy((buff + index), ScanRsp->stScanInfo[count].uSSID, len); index += len; buff[index++] = SEPARATOR; buff[index++] = ScanRsp->stScanInfo[count].uSecMode + 0x30; buff[index++] = SEPARATOR; rssi_val = ScanRsp->stScanInfo[count].uRssiVal; rsi_memcpy((buff + index), &rssi_val, 2); index += 2; buff[index++] = SEPARATOR; } count++; } index--; } break; default: break; } return index; }