本文整理汇总了C++中IS_CONNECTED函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_CONNECTED函数的具体用法?C++ IS_CONNECTED怎么用?C++ IS_CONNECTED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_CONNECTED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Network_IF_DisconnectFromAP
//*****************************************************************************
//
//! Disconnect Disconnects from an Access Point
//!
//! \param none
//!
//! \return 0 disconnected done, other already disconnected
//
//*****************************************************************************
long
Network_IF_DisconnectFromAP()
{
long lRetVal = 0;
if (IS_CONNECTED(g_ulStatus))
{
lRetVal = sl_WlanDisconnect();
if(0 == lRetVal)
{
// Wait
while(IS_CONNECTED(g_ulStatus))
{
#ifndef SL_PLATFORM_MULTI_THREADED
_SlNonOsMainLoopTask();
#else
osi_Sleep(1);
#endif
}
return lRetVal;
}
else
{
return lRetVal;
}
}
else
{
return lRetVal;
}
}
示例2: Network_IF_DisconnectFromAP
//*****************************************************************************
//
//! Disconnect Disconnects from an Access Point
//!
//! \param none
//!
//! \return none
//
//*****************************************************************************
void
Network_IF_DisconnectFromAP()
{
if (IS_CONNECTED(g_ulStatus))
sl_WlanDisconnect();
while(IS_CONNECTED(g_ulStatus));
}
示例3: replicatespuHugeOne
/**
* Send a huge buffer to one server, or all if server==-1.
*/
void
replicatespuHugeOne(CROpcode opcode, void *buf, int server)
{
unsigned int len;
unsigned char *src;
CRMessageOpcodes *msg;
int i;
/* packet length is indicated by the variable length field, and
includes an additional word for the opcode (with alignment) and
a header */
len = ((unsigned int *) buf)[-1];
if (replicate_spu.swap)
{
/* It's already been swapped, swap it back. */
len = SWAP32(len);
}
len += 4 + sizeof(CRMessageOpcodes);
/* write the opcode in just before the length */
((unsigned char *) buf)[-5] = (unsigned char) opcode;
/* fix up the pointer to the packet to include the length & opcode
& header */
src = (unsigned char *) buf - 8 - sizeof(CRMessageOpcodes);
msg = (CRMessageOpcodes *) src;
if (replicate_spu.swap)
{
msg->header.type = (CRMessageType) SWAP32(CR_MESSAGE_OPCODES);
msg->numOpcodes = SWAP32(1);
}
else
{
msg->header.type = CR_MESSAGE_OPCODES;
msg->numOpcodes = 1;
}
if (server >= 0) {
/* send to just one */
if (IS_CONNECTED(replicate_spu.rserver[server].conn)) {
crNetSend( replicate_spu.rserver[server].conn, NULL, src, len );
}
}
else {
/* send to all */
for (i = 1; i < CR_MAX_REPLICANTS; i++)
{
if (IS_CONNECTED(replicate_spu.rserver[i].conn))
{
crNetSend( replicate_spu.rserver[i].conn, NULL, src, len );
}
}
}
}
示例4: WlanConnect
//****************************************************************************
//
//! \brief Connecting to a WLAN Accesspoint
//!
//! This function connects to the required AP (SSID_NAME) with Security
//! parameters specified in te form of macros at the top of this file
//!
//! \param None
//!
//! \return 0 on success else error code
//!
//! \warning If the WLAN connection fails or we don't aquire an IP
//! address, It will be stuck in this function forever.
//
//****************************************************************************
static long WlanConnect()
{
SlSecParams_t secParams = {0};
long lRetVal = 0;
secParams.Key = SECURITY_KEY;
secParams.KeyLen = strlen(SECURITY_KEY);
secParams.Type = SECURITY_TYPE;
lRetVal = sl_WlanConnect(SSID_NAME, strlen(SSID_NAME), 0, &secParams, 0);
ASSERT_ON_ERROR(lRetVal);
// Wait for WLAN Event
while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
{
// Toggle LEDs to Indicate Connection Progress
_SlNonOsMainLoopTask();
GPIO_IF_LedOff(MCU_IP_ALLOC_IND);
MAP_UtilsDelay(800000);
_SlNonOsMainLoopTask();
GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
MAP_UtilsDelay(800000);
}
return SUCCESS;
}
示例5: WlanConnect
//****************************************************************************
//
//! \brief Connecting to a WLAN Accesspoint
//!
//! This function connects to the required AP (SSID_NAME) with Security
//! parameters specified in te form of macros at the top of this file
//!
//! \param None
//!
//! \return 0 on success else error code
//!
//! \warning If the WLAN connection fails or we don't aquire an IP
//! address, It will be stuck in this function forever.
//
//****************************************************************************
long WlanConnect()
{
long lRetVal = -1;
SlSecParams_t secParams;
secParams.Key = SECURITY_KEY;
secParams.KeyLen = strlen(SECURITY_KEY);
secParams.Type = SECURITY_TYPE;
lRetVal = sl_WlanConnect(SSID_NAME,strlen(SSID_NAME),0,&secParams,0);
ASSERT_ON_ERROR(lRetVal);
while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
{
// Toggle LEDs to Indicate Connection Progress
GPIO_IF_LedOff(MCU_IP_ALLOC_IND);
MAP_UtilsDelay(800000);
GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
MAP_UtilsDelay(800000);
}
//
// Red LED on to indicate AP connection
//
GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
return SUCCESS;
}
示例6: replicatespu_WindowDestroy
void REPLICATESPU_APIENTRY
replicatespu_WindowDestroy(GLint win)
{
WindowInfo *winInfo = (WindowInfo *) crHashtableSearch( replicate_spu.windowTable, win );
GET_THREAD(thread);
int i;
replicatespuFlushAll( (void *) thread );
if (winInfo) {
for (i = 0; i < CR_MAX_REPLICANTS; i++) {
if (!IS_CONNECTED(replicate_spu.rserver[i].conn))
continue;
if (replicate_spu.swap)
crPackWindowDestroySWAP( winInfo->id[i] );
else
crPackWindowDestroy( winInfo->id[i] );
winInfo->id[i] = -1; /* just to be safe */
replicatespuFlushOne(thread, i);
}
}
crHashtableDelete(replicate_spu.windowTable, win, crFree);
}
示例7: devmain
// USB device main loop
static void* devmain(usbdevice* kb){
readlines_ctx linectx;
readlines_ctx_init(&linectx);
while(1){
pthread_mutex_lock(dmutex(kb));
// End thread when the handle is removed
if(!IS_CONNECTED(kb))
break;
// Read from FIFO
const char* line;
euid_guard_start;
int lines = readlines(kb->infifo - 1, linectx, &line);
euid_guard_stop;
if(lines){
if(readcmd(kb, line)){
// USB transfer failed; destroy device
closeusb(kb);
break;
}
}
// Update indicator LEDs for this keyboard. These are polled rather than processed during events because they don't update
// immediately and may be changed externally by the OS.
// (also, they can lock the keyboard if they're sent at the wrong time, at least on some firmwares)
kb->vtable->updateindicators(kb, 0);
// Wait a little bit and then read again
pthread_mutex_unlock(dmutex(kb));
DELAY_SHORT(kb);
}
pthread_mutex_unlock(dmutex(kb));
readlines_ctx_free(linectx);
return 0;
}
示例8: devmain
// USB device main loop
static void* devmain(usbdevice* kb){
// dmutex should still be locked when this is called
int kbfifo = kb->infifo - 1;
readlines_ctx linectx;
readlines_ctx_init(&linectx);
while(1){
pthread_mutex_unlock(dmutex(kb));
// Read from FIFO
const char* line;
int lines = readlines(kbfifo, linectx, &line);
pthread_mutex_lock(dmutex(kb));
// End thread when the handle is removed
if(!IS_CONNECTED(kb))
break;
if(lines){
if(readcmd(kb, line)){
// USB transfer failed; destroy device
closeusb(kb);
break;
}
}
}
pthread_mutex_unlock(dmutex(kb));
readlines_ctx_free(linectx);
return 0;
}
示例9: SmartConfigTask
//*****************************************************************************
//
//! \brief Starts Smart Configuration
//!
//! \param none
//!
//! \return void
//! \note
//! \warning
//*****************************************************************************
void SmartConfigTask(void* pValue)
{
long lRetVal = -1;
DispatcherUartSendPacket((char*)pucUARTSmartConfigString,
sizeof(pucUARTSmartConfigString));
//Turn off the Network Status LED
GPIO_IF_LedOff(MCU_IP_ALLOC_IND);
LedTimerConfigNStart();
//Reset the Network Status before Entering Smart Config
Network_IF_UnsetMCUMachineState(STATUS_BIT_CONNECTION);
Network_IF_UnsetMCUMachineState(STATUS_BIT_IP_AQUIRED);
lRetVal = SmartConfigConnect();
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Wait until IP is acquired
//
while (!(IS_CONNECTED(Network_IF_CurrentMCUState())) ||
!(IS_IP_ACQUIRED(Network_IF_CurrentMCUState())));
LedTimerDeinitStop();
// Red LED on
GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
//Enable GPIO Interrupt
Button_IF_EnableInterrupt(SW2);
}
示例10: replicatespu_Finish
void REPLICATESPU_APIENTRY replicatespu_Finish( void )
{
unsigned int i;
GET_THREAD(thread);
replicatespuFlushAll( (void *) thread );
for (i = 0; i < CR_MAX_REPLICANTS; i++) {
int writeback = 1;
if (!IS_CONNECTED(replicate_spu.rserver[i].conn))
continue;
if (replicate_spu.swap) {
crPackFinishSWAP();
crPackWritebackSWAP( &writeback );
}
else {
crPackFinish();
crPackWriteback( &writeback );
}
replicatespuFlushOne(thread, i);
while (writeback)
crNetRecv();
}
}
示例11: NetStop
void NetStop()
{
unsigned long lRetVal;
//
// Disconnect from the AP
//
lRetVal = sl_WlanDisconnect();
if(0 == lRetVal)
{
// Wait
while(IS_CONNECTED(g_ulStatus))
{
#ifndef SL_PLATFORM_MULTI_THREADED
_SlNonOsMainLoopTask();
#endif
}
}
//
// Stop the simplelink host
//
sl_Stop(SL_STOP_TIMEOUT);
//
// Reset all variables
//
g_ulStatus = 0;
g_ulGatewayIP = 0;
g_ucSimplelinkstarted = 0;
g_ulIpAddr = 0;
}
示例12: wl_set_ba
int32 wl_set_ba(struct cfg_struct *cfg, uint8 *buf)
{
struct aggre_cfg_param *param;
int32 ret;
HWIFI_ASSERT((NULL != cfg) && (NULL != buf));
param = (struct aggre_cfg_param *)buf;
HWIFI_DEBUG("\naggre_cfg_param->ba_action_type = %d\n"
"\naggre_cfg_param->TID = %d\n"
"\naggre_cfg_param->max_num = %d\n",
param->ba_action_type, param->TID, param->max_num);
HWIFI_DEBUG("Mac address:" MACFMT, MAC2STR(param->mac_addr));
if(IS_STA(cfg))
{
if (!IS_CONNECTED(cfg))
{
HWIFI_WARNING("STATUS is not Connected, ba info is not supported");
return -EFAIL;
}
}
ret = hwifi_set_ba(cfg, param);
if (SUCC != ret)
{
HWIFI_WARNING("Failed to set ba!");
return ret;
}
return SUCC;
}
示例13: wlan_do_connect
STATIC modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, const char* bssid, uint8_t sec,
const char* key, uint32_t key_len, int32_t timeout) {
SlSecParams_t secParams;
secParams.Key = (_i8*)key;
secParams.KeyLen = ((key != NULL) ? key_len : 0);
secParams.Type = sec;
// first close any active connections
wlan_sl_disconnect();
if (!sl_WlanConnect((_i8*)ssid, ssid_len, (_u8*)bssid, &secParams, NULL)) {
// wait for the WLAN Event
uint32_t waitForConnectionMs = 0;
while (timeout && !IS_CONNECTED(wlan_obj.status)) {
mp_hal_delay_ms(MODWLAN_CONNECTION_WAIT_MS);
waitForConnectionMs += MODWLAN_CONNECTION_WAIT_MS;
if (timeout > 0 && waitForConnectionMs > timeout) {
return MODWLAN_ERROR_TIMEOUT;
}
wlan_update();
}
return MODWLAN_OK;
}
return MODWLAN_ERROR_INVALID_PARAMS;
}
示例14: wlan_connect
static int wlan_connect(const char *ssid, const char *pass, unsigned char sec_type)
{
SlSecParams_t secParams = {0};
long lRetVal = 0;
secParams.Key = (signed char*)pass;
secParams.KeyLen = strlen(pass);
secParams.Type = sec_type;
lRetVal = sl_WlanConnect((signed char*)ssid, strlen(ssid), 0, &secParams, 0);
ASSERT_ON_ERROR(lRetVal);
while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
_SlNonOsMainLoopTask();
SlDateTime_t dateTime= {0};
dateTime.sl_tm_day = 1; // Day of month (DD format) range 1-13
dateTime.sl_tm_mon = 1; // Month (MM format) in the range of 1-12
dateTime.sl_tm_year = 1970; // Year (YYYY format)
dateTime.sl_tm_hour = 0; // Hours in the range of 0-23
dateTime.sl_tm_min = 0; // Minutes in the range of 0-59
dateTime.sl_tm_sec = 1; // Seconds in the range of 0-59
lRetVal = sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION, SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
sizeof(SlDateTime_t),(unsigned char *)(&dateTime));
ASSERT_ON_ERROR(lRetVal);
return 0;
}
示例15: os_updateindicators
void os_updateindicators(usbdevice* kb, int force){
if(!IS_CONNECTED(kb) || NEEDS_FW_UPDATE(kb))
return;
// Set NumLock on permanently
char ileds = 1;
// Set Caps Lock if enabled. Unlike Linux, OSX keyboards have independent caps lock states, so
// we use the last-assigned value rather than fetching it from the system
if(kb->eventflags & kCGEventFlagMaskAlphaShift)
ileds |= 2;
usbmode* mode = kb->profile.currentmode;
if(mode && kb->active)
ileds = (ileds & ~mode->ioff) | mode->ion;
if(force || ileds != kb->ileds){
kb->ileds = ileds;
// Set the LEDs
CFArrayRef leds = IOHIDDeviceCopyMatchingElements(kb->handles[0], 0, kIOHIDOptionsTypeNone);
CFIndex count = CFArrayGetCount(leds);
for(CFIndex i = 0; i < count; i++){
IOHIDElementRef led = (void*)CFArrayGetValueAtIndex(leds, i);
uint32_t page = IOHIDElementGetUsagePage(led);
if(page != kHIDPage_LEDs)
continue;
uint32_t usage = IOHIDElementGetUsage(led);
IOHIDValueRef value = IOHIDValueCreateWithIntegerValue(kCFAllocatorDefault, led, 0, !!(ileds & (1 << (usage - 1))));
IOHIDDeviceSetValue(kb->handles[0], led, value);
CFRelease(value);
}
CFRelease(leds);
}
}