Merge pull request #387 from dawidowski/rework_pigpio_start_args

Change argument type of `pigpio_start` from `char*` to `const char*`
This commit is contained in:
Guy McSwain 2020-09-29 15:29:22 -05:00 committed by GitHub
commit ac5cdec256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -234,7 +234,7 @@ static int pigpio_command_ext
return cmd.res;
}
static int pigpioOpenSocket(char *addrStr, char *portStr)
static int pigpioOpenSocket(const char *addrStr, const char *portStr)
{
int sock, err, opt;
struct addrinfo hints, *res, *rp;
@ -685,7 +685,7 @@ void stop_thread(pthread_t *pth)
}
}
int pigpio_start(char *addrStr, char *portStr)
int pigpio_start(const char *addrStr, const char *portStr)
{
int pi;
int *userdata;

View File

@ -429,7 +429,7 @@ The thread to be stopped should have been started with [*start_thread*].
D*/
/*F*/
int pigpio_start(char *addrStr, char *portStr);
int pigpio_start(const char *addrStr, const char *portStr);
/*D
Connect to the pigpio daemon. Reserving command and
notification streams.

View File

@ -77,6 +77,10 @@ void t1(int pi)
gpio_write(pi, GPIO, PI_HIGH);
v = gpio_read(pi, GPIO);
CHECK(1, 6, v, 1, 0, "write, read");
v = pigpio_start(PI_DEFAULT_SOCKET_ADDR_STR, PI_DEFAULT_SOCKET_PORT_STR);
CHECK(1, 7, v, 31, 100, "pigpio_start with non-default arguments");
pigpio_stop(v);
}
int t2_count=0;