Exemplo n.º 1
0
void CDlgIPCFeature::OnCheck1() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	refresh_state();
}
Exemplo n.º 2
0
/* Insert a state object in the hash table. The object is inserted
 * at the begining of list.
 * Needs cookies, connection, and msgid.
 */
void
insert_state(struct state *st)
{
    unsigned int bucket;
    struct state **p = state_hash(st->st_icookie, st->st_rcookie, &bucket);

    passert(st->st_hashchain_prev == NULL && st->st_hashchain_next == NULL);

    DBG(DBG_CONTROL
	, DBG_log("inserting state object #%lu bucket: %u"
		  , st->st_serialno, bucket));

    if (*p != NULL)
    {
	passert((*p)->st_hashchain_prev == NULL);
	(*p)->st_hashchain_prev = st;
    }
    st->st_hashchain_next = *p;
    *p = st;

    /* Ensure that somebody is in charge of killing this state:
     * if no event is scheduled for it, schedule one to discard the state.
     * If nothing goes wrong, this event will be replaced by
     * a more appropriate one.
     */
    if (st->st_event == NULL)
	event_schedule(EVENT_SO_DISCARD, 0, st);

    refresh_state(st);
}
Exemplo n.º 3
0
BOOL CDlgIPCFeature::refresh()
{
	int slot = m_cbo_channel.GetCurSel();
	if(slot < 0 || slot >= g_window_count)
	{
		return FALSE;
	}

	connect_video();

	struct tIPCam_feature ipc_feature;
	memset(&ipc_feature,0,sizeof(ipc_feature));
	ipc_feature.slot = slot;

	if(HW_NET_SET_IPCam_GetFeature(g_server_id,&ipc_feature) == FALSE)
	{
		MessageBox("获取IPC信息失败!");
		return FALSE;
	}

	m_ae_enable =ipc_feature.bae;
	m_cbo_shutter.SetCurSel(ipc_feature.eshutter);
	m_cbo_db.SetCurSel(ipc_feature.agcgain);

	int is_flip;
	if(HW_NET_SET_GetFlipStatus(g_server_id,slot,&is_flip) == FALSE)
	{
		MessageBox("获取翻转失败");
		return FALSE;
	}

	m_enable_flip = is_flip ? TRUE : FALSE;

	UpdateData(FALSE);
	
	refresh_state();

	return TRUE;
}
Exemplo n.º 4
0
int main(int argc, char *argv[])
{
	char c;
	int i,len;
	int server_sock;
	socklen_t client_len;
	struct sockaddr_in server,client;
	struct in_addr in;
	
    struct my_socket my_socket;

    init_curses();
    draw_bottom();

    init_socket(&my_socket);
    server_sock = get_udpsocket(&my_socket);

	// communication with client
	while(1)
	{
		// wait for client request
		client_len = sizeof(client);
		len = recvfrom(server_sock, buffer, BUFFER_SIZE, 0, (struct sockaddr *)&client, &client_len);
		if (len < 0)
		{
			close(server_sock);
			fprintf(stderr, "%s\n", strerror(errno));
			exit(EXIT_FAILURE);
		}
		else
		{
            //printf("recvfrom client ok!\n");
			in.s_addr = client.sin_addr.s_addr;
            //printf("client ip  : %s\n", inet_ntoa(in));
            //printf("client port: %d\n", ntohs(client.sin_port));
            //printf("\n");
		}

		// Quit flag
		if(buffer[0] == '.') break;

		// lower to upper	
        /*
		for(i=0; i<len; i++)
		{
			c = buffer[i];
			buffer[i] = toupper(c);
		}
	
        */
		// send back to client
        //printf("%s\n",buffer);
        fill_state("newmessage",buffer);
        refresh_state();
		sendto(server_sock, buffer, len, 0, (struct sockaddr *)&client, client_len);

        memset(buffer,0,sizeof(buffer));
	}

    //printf("Client close the socket\n");
	close(server_sock);

	exit(EXIT_SUCCESS);
}