• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GAgent_Printf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Cloud_InitSocket

/****************************************************************
        Function        :   Cloud_InitSocket
        Description     :   init socket connect to server.
        iSocketId       :   socketid.
        p_szServerIPAddr:   server ip address like "192.168.1.1"
        port            :   server socket port.
        flag            :   =0 init socket in no block.
                            =1 init socket in block.
        return          :   >0 the cloud socket id 
                            <=0 fail.
****************************************************************/
int32 Cloud_InitSocket( int32 iSocketId,int8 *p_szServerIPAddr,int32 port,int8 flag )
{
    int32 ret=0;

    ret = strlen( p_szServerIPAddr );
    
    if( ret<=0 || ret> 17 )
        return RET_FAILED;

    GAgent_Printf(GAGENT_DEBUG,"socket connect cloud ip:%s .",p_szServerIPAddr);
    if( iSocketId > 0 )
    {
        GAgent_Printf(GAGENT_DEBUG, "Cloud socket need to close SocketID:[%d]", iSocketId );
        close( iSocketId );
        iSocketId = INVALID_SOCKET;
    }

    if( (iSocketId = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))<=0)
    {
        GAgent_Printf(GAGENT_ERROR," Cloud socket init fail");
        return RET_FAILED;
    }

    GAgent_Printf(GAGENT_DEBUG, "New cloud socketID [%d]",iSocketId);
    ret = GAgent_connect( iSocketId, port, p_szServerIPAddr,flag );

    if ( RET_SUCCESS!=ret )
    {
        close(iSocketId);
        iSocketId=INVALID_SOCKET;
        GAgent_Printf(GAGENT_ERROR, "Cloud socket connect fail with:%d", ret);
        return -3;
    }
    return iSocketId;
}
开发者ID:Pyin,项目名称:SimpleLink-CC3200,代码行数:46,代码来源:cloud.c


示例2: GAgent_GetHostByName

int GAgent_GetHostByName(char *domain, char *IPAddress)
{
    unsigned char Err;
    ip_addr_t ip_addr;
    char str[32];

    memset(str, 0x0, sizeof(str));

    switch (dns_gethostbyname(domain, &ip_addr, Gagent_ServerFound, NULL)) {
        case ERR_OK:
			memcpy((unsigned char*)IPAddress, (unsigned char*)inet_ntoa(ip_addr.addr), strlen(inet_ntoa(ip_addr.addr)) + 1);
        	GAgent_Printf(GAGENT_LOG, "ok Server name %s, first address: %s", 
                domain, inet_ntoa(domain_ipaddr.addr));
			return 0;
        case ERR_INPROGRESS:
            GAgent_Printf(GAGENT_LOG, "dns_gethostbyname called back success.\n\r");

			/* Waiting for connect success */
		    OSSemPend(pdomainSem, 1000, &Err);
		
		    if (domain_flag == 1) {
		        memcpy((unsigned char*)IPAddress, (unsigned char*)inet_ntoa(domain_ipaddr.addr), strlen(inet_ntoa(domain_ipaddr.addr)) + 1);
		        GAgent_Printf(GAGENT_LOG, "call back Server name %s, first address: %s", 
		                domain, inet_ntoa(domain_ipaddr.addr));
				return 0;
		    } else {
		        return -1;
		    }
            break;

        default:
            GAgent_Printf(GAGENT_LOG, "dns_gethostbyname called back error.\n\r");
            return -1;
    }
}
开发者ID:Marcello168,项目名称:NL6621_GizwitsSDK_Single,代码行数:35,代码来源:adapter_ucos.c


示例3: Socket_CreateUDPServer

int Socket_CreateUDPServer(int udp_port)
{
    struct sockaddr_in addr;
    if (g_UDPServerFd == -1) 
    {
        g_UDPServerFd = socket(AF_INET, SOCK_DGRAM, 0);
        if (g_UDPServerFd < 1)
        {
            GAgent_Printf(GAGENT_DEBUG, "UDPServer socket create error,errno:%d", errno);
            g_UDPServerFd = -1;
            return -1;
        }

        memset(&addr, 0x0, sizeof(addr));
        addr.sin_family = AF_INET;
        addr.sin_port = htons(udp_port);
        addr.sin_addr.s_addr = INADDR_ANY;

        if (bind(g_UDPServerFd, (struct sockaddr *)&addr, sizeof(addr)) != 0)
        {
            GAgent_Printf(GAGENT_DEBUG, "UDPServer socket bind error,errno:%d", errno);
            close(g_UDPServerFd);
            g_UDPServerFd = -1;
            return -1;
        }
    }
    GAgent_Printf(GAGENT_DEBUG, "UDP Server socketid:%d on port:%d", g_UDPServerFd, udp_port);
    return 0;
}
开发者ID:Marcello168,项目名称:NL6621_GizwitsSDK_Single,代码行数:29,代码来源:adapter_ucos.c


示例4: Http_POST

int32 Http_POST( int32 socketid, const int8 *host,const int8 *passcode,const int8 *mac,const uint8 *product_key )
{
    int32 ret=0;
    uint8 *postBuf=NULL;
    int8 *url = "/dev/devices"; 
    int8 Content[100]={0};
    int32 ContentLen=0;
    int32 totalLen=0;
    //int8 *contentType="application/x-www-form-urlencoded";
    
    postBuf = (uint8*)malloc(400);
    if (postBuf==NULL) return 1;
    //g_globalvar.http_sockettype =HTTP_GET_DID;//http_sockettype=1 :http_post type.

    sprintf(Content,"passcode=%s&mac=%s&product_key=%s",passcode,mac,product_key);
    ContentLen=strlen(Content);
    snprintf( postBuf,400,"%s %s %s%s%s %s%s%s %d%s%s%s%s%s",
              "POST" ,url,"HTTP/1.1",kCRLFNewLine,
              "Host:",host,kCRLFNewLine,
              "Content-Length:",ContentLen,kCRLFNewLine,
              "Content-Type: application/x-www-form-urlencoded",kCRLFNewLine,
              kCRLFNewLine,
              Content
        );
    totalLen = strlen( postBuf );
    GAgent_Printf(GAGENT_DEBUG,"http_post:%s %d",postBuf,totalLen);    
    ret = send( socketid,postBuf,totalLen,0 );
    GAgent_Printf(GAGENT_DEBUG,"http_post ret: %d",ret);    
    free( postBuf );
    return 0;
}
开发者ID:ClarePhang,项目名称:SimpleLink-CC3200,代码行数:31,代码来源:http.c


示例5: Socket_CreateUDPBroadCastServer

int Socket_CreateUDPBroadCastServer( int udp_port )
{
    int udpbufsize = 2;

    if ( g_UDPBroadcastServerFd == -1 )
    {
        g_UDPBroadcastServerFd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
        if (g_UDPBroadcastServerFd < 0)
        {
            GAgent_Printf(GAGENT_DEBUG, "UDP BC socket create error, errno:%d", errno);
            g_UDPBroadcastServerFd = -1;
            return -1;
        }

        g_stUDPBroadcastAddr.sin_family = AF_INET;
        g_stUDPBroadcastAddr.sin_port = htons(udp_port);
        g_stUDPBroadcastAddr.sin_addr.s_addr = htonl(INADDR_BROADCAST);

        if (setsockopt(g_UDPBroadcastServerFd, SOL_SOCKET, SO_BROADCAST, &udpbufsize, sizeof(int)) != 0)
        {
            GAgent_Printf(GAGENT_DEBUG, "UDP BC Server setsockopt error,errno:%d", errno);
            //return;
        }

        if (bind(g_UDPBroadcastServerFd, (struct sockaddr *)&g_stUDPBroadcastAddr, sizeof(g_stUDPBroadcastAddr)) != 0)
        {
            GAgent_Printf(GAGENT_DEBUG, "UDP BC Server bind error,errno:%d", errno);
            close(g_UDPBroadcastServerFd);
            g_UDPBroadcastServerFd = -1;
            return -1;
        }
    }
    GAgent_Printf(GAGENT_DEBUG, "UDP BC Server socketid:%d on port:%d", g_UDPBroadcastServerFd, udp_port);
    return 0;
}
开发者ID:Marcello168,项目名称:NL6621_GizwitsSDK_Single,代码行数:35,代码来源:adapter_ucos.c


示例6: GAgent_Socket_DispatchUDPRecvData

int GAgent_Socket_DispatchUDPRecvData( u8 *pData, int varlen, int messagelen, struct sockaddr_t addr, socklen_t addrLen)
{
    int ret;
    u8 Udp_ReDiscover[200] =  {0};
    char Udp_ReOnBoarding[8] = {0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x02};

    if( pData[7]==0x01 )//OnBoarding
    {

        GAgent_Printf(GAGENT_INFO,"OnBoarding");

        Udp_Onboarding(pData,messagelen);
        GAgent_Socket_sendto(g_GAgent_UDPServerFd, Udp_ReOnBoarding, 8, &addr, sizeof(struct sockaddr_t));
        DRV_GAgent_Reset();
        return 0;
    }
    if( pData[7]==0x03 ) //Ondiscover
    {
        GAgent_Printf(GAGENT_INFO,"Ondiscover");
        GAgent_Build_BroadCastPacket( 0, Udp_ReDiscover );
        ret = GAgent_Socket_sendto(g_GAgent_UDPServerFd, Udp_ReDiscover,Udp_ReDiscover[4]+5, &addr, sizeof(struct sockaddr_t));
        if(ret != Udp_ReDiscover[4]+5)
        {
            GAgent_Printf(GAGENT_ERROR,"send discover response fail.ret:0x%x", ret);
        }
        return 0;
    }
    GAgent_Printf(GAGENT_WARNING,"invalid udp packet [%d]", pData[7]);
    return -1;
}
开发者ID:curiousguy98,项目名称:LazyPlant,代码行数:30,代码来源:Socket.c


示例7: check_mqttpushqos1

/*************************************************
 *
 *		Function : check mqtt witch qos 1
 *		packet_bufferBUF: MQTT receive data
 *		packet_length :	the packet length 
 *   add by Ale lin  2014-04-03
 *		
 ***************************************************/
int check_mqttpushqos1( uint8_t *packet_bufferBUF,int packet_length, uint16_t msg_id )
{
    uint16_t msg_id_rcv;
    uint8_t *packet_buffer=NULL;
    packet_buffer = ( uint8_t* )malloc(packet_length);
    memset( packet_buffer,0,packet_length);
    memcpy( packet_buffer,packet_bufferBUF,packet_length);
    if(packet_length < 0)
    {
        GAgent_Printf(GAGENT_INFO,"Error on read packet!");	
        free(packet_buffer);
        return -1;
    }
    if(MQTTParseMessageType(packet_buffer) != MQTT_MSG_PUBACK)
    {
        GAgent_Printf(GAGENT_INFO,"PUBACK expected!");
        free(packet_buffer);
        return -1;						
    }
    msg_id_rcv = mqtt_parse_msg_id(packet_buffer);
    if(msg_id != msg_id_rcv)
    {
        GAgent_Printf(GAGENT_INFO," message id was expected, but message id was found!");
        free(packet_buffer);
        return -1;
    }			
    free(packet_buffer);						
    GAgent_Printf(GAGENT_INFO,"check_mqttpushqos1 OK");
    
    return 1;														
}
开发者ID:WenruiShen,项目名称:gizwits-Gizwits-GAgent,代码行数:39,代码来源:mqttbase.c


示例8: Mqtt_SendConnetPacket

/***********************************************************
 *
 *   return :    0 success ,1 error
 *
 *************************************************************/
int32 Mqtt_SendConnetPacket( mqtt_broker_handle_t *pstBroketHandle, int32 socketid,const int8* username,const int8* password )
{       
    int32 ret;
    
    if( (username==NULL) || (password==NULL) )// 匿名登录 GAgent V4 will not runing this code.
    {
        return 1;
    }
    else // 用户登录
    {
        mqtt_init( pstBroketHandle,username );
        mqtt_init_auth(pstBroketHandle,username,password );
    }
    mqtt_set_alive(pstBroketHandle, CLOUD_MQTT_SET_ALIVE);
    pstBroketHandle->socketid = socketid;
    pstBroketHandle->mqttsend = send_packet;

    ret = mqtt_connect(pstBroketHandle);
    if (ret != 0)
        {
            GAgent_Printf(GAGENT_WARNING,"mqtt send connect packet is failed with:%d", ret); 
            return 1;
        }
    GAgent_Printf(GAGENT_INFO, "Mqtt_SendConnetPacket OK, write:%d", ret); 
    return 0;
}
开发者ID:andy521,项目名称:Gizwits-GAgent,代码行数:31,代码来源:mqttxpg.c


示例9: Http_JD_Get_uuid_req

/******************************************************
 *
 *   FUNCTION       :   get the uuid by productkey in HTTP GET
 *      productkey  :   productkey
 *      host        :   host
 *      return      :   0-OK 1-fail
 *   Add by Alex lin  --2014-11-10
 *
 ********************************************************/
int32 Http_JD_Get_uuid_req( const int8 *host,const int8 *product_key )
{
    int8 *getBuf=NULL;
    int32 totalLen=0;
    int32 ret=0;
    int8 *url = "/dev/jd/product/";    
    if( strlen(product_key)<=0 )
    {   
        GAgent_Printf(GAGENT_ERROR,"need a productkey to get uuid! ");
        return 1;
    }
    getBuf = (int8*)malloc(500);
    if (getBuf==NULL)  return 1;
    memset( getBuf,0,500 ); 
    //g_globalvar.http_sockettype =HTTP_GET_JD_UUID;//http get product_uuid for JD.

    sprintf( getBuf,"%s %s%s%s%s%s%s%s%s%s",
             "GET",url,product_key," HTTP/1.1",kCRLFNewLine,
             "Host: ",host,kCRLFNewLine,
             "Cache-Control: no-cache",kCRLFLineEnding );

    totalLen =strlen( getBuf );
    GAgent_Printf(GAGENT_DEBUG,"totalLen=%d\r\n",totalLen);
    GAgent_Printf(GAGENT_DEBUG,"Sent Http to get JD uuid.\n");
    GAgent_Printf(GAGENT_DUMP,"%s",getBuf );
    free(getBuf);
   
    if(ret>0) return 0; 
    else    return 1;
}
开发者ID:ClarePhang,项目名称:SimpleLink-CC3200,代码行数:39,代码来源:http.c


示例10: Mqtt_Login2Server

int32 Mqtt_Login2Server(  int32 socketid,const uint8 *username,const uint8 *password )
{
    if( Mqtt_SendConnetPacket( &g_stMQTTBroker,socketid,(const int8*)username,(const int8*)password ) == 0)
    {    
        GAgent_Printf(GAGENT_INFO," Mqtt_SendConnetPacket OK!");
        return 0;
    }   
    GAgent_Printf(GAGENT_INFO," Mqtt_SendConnetPacket NO!");    
    
    return 1;
}
开发者ID:andy521,项目名称:Gizwits-GAgent,代码行数:11,代码来源:mqttxpg.c


示例11: debugpacket

void debugpacket(ppacket pp)
{
    if(pp->pend < pp->ppayload)
    {
        GAgent_Printf(GAGENT_DEBUG, "Wrong packet to dump");
        return;
    }
    GAgent_Printf(GAGENT_DEBUG, "Packet info: len = %x, head len = %x, payload len = %x",
                  pp->pend - pp->phead, pp->ppayload - pp->phead, pp->pend - pp->ppayload);
    GAgent_DebugPacket(pp->phead, pp->pend - pp->phead);
}
开发者ID:OpenFPGAduino,项目名称:Gizwits-GAgent,代码行数:11,代码来源:utilcoding.c


示例12: Local_SendData

/****************************************************************
FunctionName    :   GAgent_LocalSendData
Description     :   send data to local io.
return          :   NULL
Add by Alex.lin     --2015-04-07
****************************************************************/
uint32 Local_SendData( int32 fd,uint8 *pData, int32 bufferMaxLen )
{
    int32 i=0;
    if( PF_SendData2MCU!=NULL )
    {
        GAgent_Printf( GAGENT_DUMP,"local send len = %d:\r\n",bufferMaxLen );
        for( i=0;i<bufferMaxLen;i++ )
            GAgent_Printf( GAGENT_DUMP," %02x",pData[i]);
        GAgent_Printf( GAGENT_DUMP,"\r\n");
        PF_SendData2MCU( fd,pData,bufferMaxLen );
    }
    return 0;
}
开发者ID:WenruiShen,项目名称:gizwits-Gizwits-GAgent,代码行数:19,代码来源:local.c


示例13: GAgent_Socket_CheckNewTCPClient

int GAgent_Socket_CheckNewTCPClient(void)
{
    fd_set readfds, exceptfds;
    int ret;
    int newClientfd;
    int i;
    struct sockaddr_t addr;
	struct timeval_t t;
    int addrlen= sizeof(addr);
    t.tv_sec = 0;//秒
    t.tv_usec = 0;//微秒
    /*Check status on erery sockets */
    FD_ZERO(&readfds);
    FD_SET(g_GAgent_TCPServerFd, &readfds);

    ret = select((g_GAgent_TCPServerFd+1), &readfds, NULL, &exceptfds, &t);

    if (ret > 0)
    {
        newClientfd = GAgent_Socket_accept(g_GAgent_TCPServerFd, &addr, &addrlen);
        GAgent_Printf(GAGENT_DEBUG, "detected new client as %d", newClientfd);
        if (newClientfd > 0)
        {
            if(g_GAgent_TCPSocketMaxClientFd<newClientfd)
            {
                g_GAgent_TCPSocketMaxClientFd=(newClientfd+1); /*Select接口要求+1*/
            }
            for(i=0;i<SOCKET_MAXTCPCLENT;i++) 
            {
                if (g_GAgent_stTCPSocketClients[i].SocketFD == -1) 
                {
                    memcpy(&g_GAgent_stTCPSocketClients[i].TCPClientAddr, &addr, sizeof(addr));
                    g_GAgent_stTCPSocketClients[i].SocketFD = newClientfd;
                    g_GAgent_stTCPSocketClients[i].TimeOut = LAN_CLIENT_MAXLIVETIME;
                    GAgent_Printf(GAGENT_INFO, "new tcp client, clientid:%d[%d] [time:%08x second: %08x MS]", 
                        newClientfd, i, DRV_GAgent_GetTime_S(), DRV_GAgent_GetTime_MS() );
                    
                    return newClientfd; //返回连接ID
                }
            }
            /*此时连接个数大于系统定义的最大个数,应该关闭释放掉对应的socket资源*/           
            close( newClientfd );
        }
        else
        {
            GAgent_Printf(GAGENT_DEBUG, "Failed to accept client");
        }
    }
    return -1;
}
开发者ID:curiousguy98,项目名称:LazyPlant,代码行数:50,代码来源:Socket.c


示例14: Gagent_ServerFound

void Gagent_ServerFound(const char *name, ip_addr_t *ipaddr, void *arg)
{
    if ((ipaddr) && (ipaddr->addr)) {
        memcpy(&domain_ipaddr, ipaddr, sizeof(ip_addr_t));
        domain_flag = 1;
        GAgent_Printf(GAGENT_LOG, "Get DNS server ip success.\n\r");

    } else {
        domain_flag = 0;
        GAgent_Printf(GAGENT_LOG, "Get DNS server ip error.\n\r");    
    }

    OSSemPost(pdomainSem);
}
开发者ID:Marcello168,项目名称:NL6621_GizwitsSDK_Single,代码行数:14,代码来源:adapter_ucos.c


示例15: GAgent_Local_ExtractOnePacket

/****************************************************************
FunctionName    :   GAgent_Local_ExtractOnePacket
Description     :   extract one packet from local cycle buf, and 
                    put data into buf.Will change pos_start
buf             :   dest buf
return          :   >0 the local packet data length.
                    <0 don't have one whole packet data
****************************************************************/
int32 GAgent_Local_ExtractOnePacket(uint8 *buf)
{
    int32 ret;
    uint32 i;
    uint16 packetLen;

    if(NULL == buf)
    {
        GAgent_Printf(GAGENT_WARNING,"%s,%d,Input buf is NULL", __FUNCTION__, __LINE__);
        return RET_FAILED;
    }

    /* find one packet data form position pos_start of local driver buf */
    ret = find_packet_forward(pos_start, &packetLen);
    if(ret >= 0)
    {
        /* a whole packet */
        pos_start = ret;
        for(i = 0; i < packetLen; i++)
        {
            buf[i] = __halbuf_read(pos_start + i);
        }
        pos_start += packetLen;
        
        return packetLen;
    }

    return RET_FAILED;
}
开发者ID:139demajia,项目名称:Gizwits-GAgent,代码行数:37,代码来源:hal_receive.c


示例16: MQTT_readPacket

int32 MQTT_readPacket( int32 socketid,ppacket pbuf,int32 bufferLen )
{
    int32 bytes_rcvd;
    uint8_t *pData;
    int32 messageLen;
    int32 varLen;
    int32 packet_length;

    memset(pbuf->phead, 0, bufferLen);
    pData = pbuf->phead;
    bytes_rcvd = recv(socketid, pData , bufferLen, 0);
    if((bytes_rcvd) <= 0)
    {
        MQTTclose_socket( &g_stMQTTBroker );
        return -1;
    }
    //pData = packetBuffer + 0;
    pbuf->pend=pbuf->phead+bytes_rcvd;
    
    messageLen = mqtt_parse_rem_len(pData);
    varLen = mqtt_num_rem_len_bytes(pData);
    if(varLen<1 || varLen>4)
    {
         return -3;
    }
    packet_length = varLen + messageLen + 1;

    if (bytes_rcvd < packet_length)
    {
        GAgent_Printf(GAGENT_INFO, " packet length too long %s:%d ", __FUNCTION__, __LINE__);
        return -3;
    }
   
    return bytes_rcvd;
}
开发者ID:andy521,项目名称:Gizwits-GAgent,代码行数:35,代码来源:mqttxpg.c


示例17: GAgent_Socket_ClientTimeoutTimer

void GAgent_Socket_ClientTimeoutTimer(void)
{
    int i,j;

    for (i = 0; i < SOCKET_MAXTCPCLENT; i++)
    {
        if (g_GAgent_stTCPSocketClients[i].TimeOut > 0)
        {
            g_GAgent_stTCPSocketClients[i].TimeOut --;
            
            if (g_GAgent_stTCPSocketClients[i].TimeOut ==0)
            {
                GAgent_Printf(GAGENT_DEBUG, 
                    "Close socket(%d) now[time:%08x second: %08x MS] ", 
                g_GAgent_stTCPSocketClients[i].SocketFD, DRV_GAgent_GetTime_S(), 
                DRV_GAgent_GetTime_MS());
                close(g_GAgent_stTCPSocketClients[i].SocketFD);
								for( j=0;j<8;j++ )
								{
										if(g_SocketLogin[j]==g_GAgent_stTCPSocketClients[i].SocketFD)
											g_SocketLogin[j]=0;
								}
                g_GAgent_stTCPSocketClients[i].SocketFD = -1;
								
            }
        }
    }

    return;
}
开发者ID:curiousguy98,项目名称:LazyPlant,代码行数:30,代码来源:Socket.c


示例18: GAgent_Clean_Config

/****************************************************************
FunctionName    :   GAgent_Clean_Config
Description     :   GAgent clean the device config                  
pgc             :   global staruc 
return          :   NULL
Add by Frank Liu     --2015-05-08
****************************************************************/
void GAgent_Clean_Config( pgcontext pgc )
{
    memset( pgc->gc.old_did,0,DID_LEN);
    memset( pgc->gc.old_wifipasscode,0,PASSCODE_MAXLEN + 1);
  
    memcpy( pgc->gc.old_did,pgc->gc.DID,DID_LEN );
    memcpy( pgc->gc.old_wifipasscode,pgc->gc.wifipasscode,PASSCODE_MAXLEN + 1 );
    GAgent_Printf(GAGENT_INFO,"Reset GAgent and goto Disable Device !");  
    Cloud_ReqDisable( pgc );
    GAgent_SetCloudConfigStatus( pgc,CLOUD_RES_DISABLE_DID );

    memset( pgc->gc.wifipasscode,0,PASSCODE_MAXLEN + 1);
    memset( pgc->gc.wifi_ssid,0,SSID_LEN_MAX + 1 );
    memset( pgc->gc.wifi_key,0, WIFIKEY_LEN_MAX + 1 );
    memset( pgc->gc.DID,0,DID_LEN);
    
    memset( (uint8*)&(pgc->gc.cloud3info),0,sizeof( GAgent3Cloud ) );
    
    memset( pgc->gc.GServer_ip,0,IP_LEN_MAX + 1);
    memset( pgc->gc.m2m_ip,0,IP_LEN_MAX + 1);
    make_rand(pgc->gc.wifipasscode);

    pgc->gc.flag &=~XPG_CFG_FLAG_CONNECTED;
    GAgent_DevSaveConfigData( &(pgc->gc) );
}
开发者ID:WenruiShen,项目名称:gizwits-Gizwits-GAgent,代码行数:32,代码来源:local.c


示例19: GAgent_LocalSendGAgentstatus

/****************************************************************
        FunctionName        :   GAgent_LocalSendGAgentstatus.
        Description         :   check Gagent's status whether it is update.
        Add by Nik.chen     --2015-04-18
****************************************************************/
void GAgent_LocalSendGAgentstatus(pgcontext pgc,uint32 dTime_s )
{
    uint16 GAgentStatus = 0; 
    uint16 LastGAgentStatus = 0; 
    resetPacket( pgc->rtinfo.Rxbuf );
    if( (pgc->rtinfo.GAgentStatus) != (pgc->rtinfo.lastGAgentStatus) )
    {
          GAgentStatus = pgc->rtinfo.GAgentStatus&LOCAL_GAGENTSTATUS_MASK;
          LastGAgentStatus = pgc->rtinfo.lastGAgentStatus&LOCAL_GAGENTSTATUS_MASK;
          GAgent_Printf( GAGENT_INFO,"GAgentStatus change, lastGAgentStatus=0x%04x, newGAgentStatus=0x%04x", LastGAgentStatus, GAgentStatus);
          pgc->rtinfo.lastGAgentStatus = pgc->rtinfo.GAgentStatus&LOCAL_GAGENTSTATUS_MASK;
          GAgentStatus = htons(GAgentStatus);
          memcpy((pgc->rtinfo.Rxbuf->ppayload), (uint8 *)&GAgentStatus, 2);
          pgc->rtinfo.Rxbuf->pend =  (pgc->rtinfo.Rxbuf->ppayload)+2;
          pgc->rtinfo.updatestatusinterval =  0; 
          //GAgent_Printf(GAGENT_CRITICAL,"updateGagentstatusLast time=%d", (pgc->rtinfo.send2LocalLastTime));
         GAgent_LocalDataWriteP0( pgc,pgc->rtinfo.local.uart_fd, (pgc->rtinfo.Rxbuf), WIFI_STATUS2MCU );
    }

     pgc->rtinfo.updatestatusinterval+= dTime_s;

    if( (pgc->rtinfo.updatestatusinterval)  > LOCAL_GAGENTSTATUS_INTERVAL)
    {
        pgc->rtinfo.updatestatusinterval = 0;
        GAgentStatus = pgc->rtinfo.GAgentStatus&LOCAL_GAGENTSTATUS_MASK;
        GAgentStatus = htons(GAgentStatus);
        memcpy((pgc->rtinfo.Rxbuf->ppayload), (uint8 *)&GAgentStatus, 2);
        pgc->rtinfo.Rxbuf->pend =  (pgc->rtinfo.Rxbuf->ppayload)+2;
        GAgent_LocalDataWriteP0( pgc,pgc->rtinfo.local.uart_fd, (pgc->rtinfo.Rxbuf), WIFI_STATUS2MCU );
    }
}
开发者ID:WenruiShen,项目名称:gizwits-Gizwits-GAgent,代码行数:36,代码来源:local.c


示例20: send_packet

int send_packet(int socketid, const void* buf, unsigned int count)
{
    int ret;
    ret = send(socketid, buf, count, 0);
    GAgent_Printf(GAGENT_INFO,"MQTT Send packet length=%d",ret );
    return ret;
}
开发者ID:WenruiShen,项目名称:gizwits-Gizwits-GAgent,代码行数:7,代码来源:mqttbase.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GB函数代码示例发布时间:2022-05-30
下一篇:
C++ GATT_NUM_ATTRS函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap