Beispiel #1
0
uint32 GAgent_Lan_Handle(pgcontext pgc, ppacket prxBuf,int32 len)
{
    int i =0;
    int fd =0;
    int ret =0;
    uint16 GAgentStatus=0;
    GAgentStatus = pgc->rtinfo.GAgentStatus;
    {
        GAgent_DoTcpWebConfig( pgc );
        Lan_udpDataHandle(pgc, prxBuf, len);
        Lan_TcpServerHandler(pgc);
        GAgent3rdLan_Handle( pgc );
        for(i = 0;i < LAN_TCPCLIENT_MAX; i++)
        {
            fd = pgc->ls.tcpClient[i].fd;
            if(fd <= 0)
                continue;
            if(FD_ISSET(fd, &(pgc->rtinfo.readfd)))
            {
                ret = Lan_tcpClientDataHandle(pgc, i, prxBuf, /* ptxBuf,*/ len);
                if(ret > 0)
                {
                    dealPacket(pgc, prxBuf);
                    Lan_ClearClientAttrs(pgc, &pgc->ls.srcAttrs);
                    clearChannelAttrs(pgc);
                }
            }
        }
    }
    return 0;
}
Beispiel #2
0
void setChannelAttrs(pgcontext pgc, stCloudAttrs_t *cloudClient, stLanAttrs_t *lanClient, uint8 isBroadCast)
{
    if(isBroadCast)
    {
        pgc->rtinfo.stChannelAttrs.lanClient.fd = -1;
        pgc->rtinfo.stChannelAttrs.lanClient.cmd = GAGENT_LAN_CMD_CTL_93;
        pgc->rtinfo.stChannelAttrs.lanClient.sn = 0;

        pgc->rtinfo.stChannelAttrs.cloudClient.phoneClientId[0] = '\0';
        pgc->rtinfo.stChannelAttrs.cloudClient.cmd = GAGENT_LAN_CMD_CTL_93;
        pgc->rtinfo.stChannelAttrs.cloudClient.sn = 0;

    }
    else
    {
        if(NULL != lanClient)
        {
            pgc->rtinfo.stChannelAttrs.lanClient = *lanClient;
            pgc->rtinfo.stChannelAttrs.lanClient.cmd += 1;
            Lan_ClearClientAttrs(pgc, &pgc->ls.srcAttrs);
        }
        if(NULL != cloudClient)
        {
            pgc->rtinfo.stChannelAttrs.cloudClient = *cloudClient;
            pgc->rtinfo.stChannelAttrs.cloudClient.cmd += 1;
            Cloud_ClearClientAttrs(pgc, &pgc->rtinfo.waninfo.srcAttrs);
        }
    }
    
}
void setChannelAttrs(pgcontext pgc, stCloudAttrs_t *cloudClient, stLanAttrs_t *lanClient, uint8 isBroadCast)
{
    if(isBroadCast)
    {
        pgc->rtinfo.stChannelAttrs.lanClient.fd = -1;
        /* use 0x0091, Cloud and APP will support cmd 0x0091 */
        pgc->rtinfo.stChannelAttrs.lanClient.cmd = GAGENT_LAN_CMD_TRANSMIT_91;
        pgc->rtinfo.stChannelAttrs.lanClient.sn = 0;

        pgc->rtinfo.stChannelAttrs.cloudClient.phoneClientId[0] = '\0';
        /* use 0x0091, Cloud and APP will support cmd 0x0091 */
        pgc->rtinfo.stChannelAttrs.cloudClient.cmd = GAGENT_LAN_CMD_TRANSMIT_91;
        pgc->rtinfo.stChannelAttrs.cloudClient.sn = 0;

    }
    else
    {
        if(NULL != lanClient)
        {
            pgc->rtinfo.stChannelAttrs.lanClient = *lanClient;
            pgc->rtinfo.stChannelAttrs.lanClient.cmd += 1;
            Lan_ClearClientAttrs(pgc, &pgc->ls.srcAttrs);
        }
        if(NULL != cloudClient)
        {
            pgc->rtinfo.stChannelAttrs.cloudClient = *cloudClient;
            pgc->rtinfo.stChannelAttrs.cloudClient.cmd += 1;
            Cloud_ClearClientAttrs(pgc, &pgc->rtinfo.waninfo.srcAttrs);
        }
    }
    
}
Beispiel #4
0
void clearChannelAttrs(pgcontext pgc)
{
    Lan_ClearClientAttrs( pgc, &pgc->rtinfo.stChannelAttrs.lanClient );
    Cloud_ClearClientAttrs( pgc, &pgc->rtinfo.stChannelAttrs.cloudClient );
}