You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
robomaster-sdk/src/robomaster.c

34 lines
864 B
C

#include "robomaster.h"
#include "client.h"
#include "message.h"
#include "connection.h"
#include <stdlib.h>
#include <string.h>
Client client_new() {
struct Client* client = malloc(sizeof(struct Client));
memset(client, 0, sizeof(struct Client));
// TODO: Make this configurable
client->hostbyte = host2byte(DEFAULT_CLIENT_HOST, DEFAULT_CLIENT_INDEX);
return client;
}
void client_connect(Client client) {
client->sdk_conn = connection_new(0, 0, 30030, "192.168.2.1");
client->dev_conn = connection_new(10010, "192.168.2.24", 20020, "192.168.2.1");
set_sdk_connection(client, CONNECTION_WIFI_AP, 0, 10010);
}
void poll_message(Client client, union Message* resp) {
memset(resp, 0, sizeof(union Message));
struct Connection* conn = connection_poll_ready(client);
if(conn)
connection_read(conn, resp);
}