Beispiel #1
0
void recv_func(void* arg)
{
	uint32_t user_id;
	struct msg_packet msg;
	while(1)
	{
		msg_recv(&msg);
		user_id = process_msg(&msg);

		switch (GET_MODE(msg.command))
		{
		case IPMSG_SENDMSG:
			console_clear_line(-1);
 			shell_recv_msg(user_id);
			printf("%s", buff);
			break;

		case IPMSG_ANSENTRY:
		case IPMSG_BR_ENTRY:
			shell_user_entry(user_id);

		case IPMSG_BR_EXIT:
			console_clear_line(-1);
			shell_user_exit(user_id, msg.msg);
			printf("%s", buff);
			break;
		}
	}
}
Beispiel #2
0
int console_status(uint16_t color, const char *s) {
	char c;
	int i = 0;

	const uint16_t fore_current = cur_fore;
	const uint16_t back_current = cur_back;

	const uint16_t s_y = current_y;
	const uint16_t s_x = current_x;

	console_clear_line(29);

	cur_fore = color;
	cur_back = CONSOLE_BLACK;

	while ((c = *s++) != (char) 0) {
		i++;
		(void) console_putc((int) c);
	}

	current_y = s_y;
	current_x = s_x;

	cur_fore = fore_current;
	cur_back = back_current;

	return i;
}
Beispiel #3
0
void DMXMonitor::Start(void) {
    for (int i = TOP_ROW; i < (TOP_ROW + 17); i++) {
        console_clear_line(i);
    }

    console_set_cursor(0, TOP_ROW);
    console_puts("    00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31\n");

    for (int i = 1; i < (int)(16 * 32) ; i = i + (int)32) {
        printf("%3d\n", i);
    }
}
Beispiel #4
0
void DMXMonitor::Stop(void) {
    for (int i = TOP_ROW; i < (TOP_ROW + 17); i++) {
        console_clear_line(i);
    }
}
Beispiel #5
0
int main(int argc, char* argv[])
{
	char c;
	int is_wchar = 0;

	ipmsg_init();
	shell_parse_cmd("list");

 	_beginthread(recv_func,0,0);

	while(1)
	{
		int buff_pos = 0;
		memset(buff, 0, sizeof(buff));

		fflush(stdout);
		while((c = getch()) != '\r')
		{
			if(!is_wchar) {
				if(c == 0 || c == -32) {
					getch();
					continue;
				}
			}

			switch(c)
			{
			case '\b':
				{
					if(buff_pos == 0)
						break;

					if(!isascii(buff[--buff_pos]))
						--buff_pos;

					if(buff_pos < 0)
						buff_pos = 0;

					buff[buff_pos] = 0;
					printf("\r%s  \r%s",buff,buff);
				}
				break;
			default:
				{
					buff[buff_pos++] = c;
					printf("%c",c);

					if(!isascii(c))
						is_wchar = !is_wchar;
				}
				break;
			}
		}

		if(buff[0])
		{
			console_clear_line(-1);

			if(buff[0] == '-')
			{
				if(_stricmp(buff+1, "exit") == 0)
				{
					broadcast_status(IPMSG_BR_EXIT);
					break;
				}

				shell_parse_cmd(buff+1);
				continue;
			}

			shell_self_say(buff);
		}
	}

	user_clear();
	return 0;
}