Forum Replies Created
-
AuthorPosts
-
locodParticipant
Small update, not that anybody cares.
I got it working with winsock, I was sending the wrong way, wrong formatint intSlider2 = slider2 * 100; std::stringstream cmd1; cmd1 << "PUT /parameter/hd1/spk/volume=" << intSlider2 << " HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n"; std::string getInput = cmd1.str().c_str(); connection = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (connect(connection, (SOCKADDR*)&addr, addrLen) == 0) { send(connection, getInput.c_str(), strlen(getInput.c_str()), 0); closesocket(connection); }
midi device talks to virtualdj, vdj talks to plugin, plugin talks to BA1, added bonus I have real time metadata update, I notice a few streams the meta is updated too early or late. If anybody is a vdj && BA1 user you can contact me here.
- This reply was modified 3 years, 1 month ago by locod.
locodParticipantI tried that also, my original intel was a AHK script and that used GET
However, I found the solution […a solution] I started trying things that shouldn’t work, and then it worked, no tailoring, real formatting, GET or PUT, just send it all, full path
curl_easy_setopt(curl, CURLOPT_URL, "127.0.0.1:8282/parameter/hd1/spk/volume=0"); // NOT NEEDED APPARENTLY curl_easy_setopt(curl, CURLOPT_HTTPGET, "/parameter/hd1/spk/volume?=0"); /* Perform the request, res will get the return code */ res = curl_easy_perform(curl);
After discovering that, 20 minutes later I’ve have a device talking to a virtualdj plugin, the plugin talks to BA1
locodParticipantfinally found a distro for libcurl that avoids all the config,
I have this simple console app, it connects, it returns OK, it doesn’t move the vol slider though#include <stdio.h> #include <curl/curl.h> int main(void) { CURL* curl; CURLcode res; /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); /* get a curl handle */ curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, "127.0.0.1:8282"); curl_easy_setopt(curl, CURLOPT_HTTPGET, "/parameter/hd1/spk/volume?=0"); /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); /* Check for errors */ if (res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); /* always cleanup */ curl_easy_cleanup(curl); } curl_global_cleanup(); return 0; }
locodParticipantIsn’t cmd or a browser going to make a window appear every time I touch the slider? to drop the slider to zero is a incremental step, the goal is control from a midi device slider.
locodParticipantI’m even further lost, your examples are command line, I can’t find any simple examples using libcurl, [anywhere]
Seemed too easy getting a client connection in the first 20 minutes, and now I’ve been 20 tabs deep for 8 hours, and I’m still no wiser.
Can’t winsock do it? Or could I get a short libcurl example please. [connect & request]locodParticipantWait is cURL command line? is that going to work with a midi slider?
locodParticipant@Milky I haven’t, I thought it could be done without 3rd party libs.
embarrassingly I had to look up how to even install a lib, I suppose the day hasn’t been a total waste then.Thanks, I might be back.
locodParticipantAs best as I can figure this is the GET request I should send(),
but I don’t know, maybe there’s something here I fundamentally don’t understand.
I can’t even figure if I should be using BARemote or not, slightly frustrated now, but that’s par for the course with c++ [at least for me]string getInput = "GET /parameter/hd1/spk/volume?=0 HTTP/1.1\r\nHOST: http://127.0.0.1:8282\r\n\r\n"; send(connection, getInput.c_str(), strlen(getInput.c_str()), 0);
- This reply was modified 3 years, 2 months ago by locod.
locodParticipantsmall typo in my code snippet
addr.sin_port = htons(8200);
should be 8282
still lost -
AuthorPosts