📄 test_gps.c
字号:
/*************************************************************************** * Desc: Tests for the GPS device * Author: Andrew Howard * Date: 26 May 2002 # CVS: $Id: test_gps.c,v 1.1.8.1 2003/05/23 21:23:43 inspectorg Exp $ **************************************************************************/#include "test.h"#include "playerc.h"// Basic test for GPS device.int test_gps(playerc_client_t *client, int index){ int t; void *rdevice; playerc_gps_t *device; printf("device [gps] index [%d]\n", index); device = playerc_gps_create(client, index); TEST("subscribing (read/write)"); if (playerc_gps_subscribe(device, PLAYER_ALL_MODE) != 0) { FAIL(); return -1; } PASS(); for (t = 0; t < 3; t++) { TEST1("reading data (attempt %d)", t); do rdevice = playerc_client_read(client); while (rdevice == client); if (rdevice == device) { PASS(); printf("gps: [%6.3f] [%6.3f] [%6.3f]\n", device->px, device->py, device->pa); } else FAIL(); } TEST("unsubscribing"); if (playerc_gps_unsubscribe(device) != 0) { FAIL(); return -1; } PASS(); playerc_gps_destroy(device); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -