Beispiel #1
0
//--------------------------------------------------------------
void ofxEtherdream::send() {
//    if(!stateIsFound() || points.empty()) return;
	
	if((points.empty()) || (device==NULL) || (device->state == ST_DISCONNECTED) || (device->state == ST_BROKEN) || (device->state == ST_SHUTDOWN)) return;
  
	//cout << "ETHERDREAM SENDING POINTS " << points.size() << endl;
    
	if(bWaitBeforeSend) etherdream_wait_for_ready(device);
    else if(!etherdream_is_ready(device)) return;
	/*
    dataBuffer.clear();
	// fill the buffer with something important
	for(int i = 0; i<points.size(); i++) {
		ofxIlda::Point& p = points[i];
		dataBuffer.append(ofToString(p.x)+ " " );
		dataBuffer.append(ofToString(p.y)+ " " );
		dataBuffer.append(ofToString(p.r)+ " " );
		dataBuffer.append(ofToString(p.g)+ " " );
		dataBuffer.append(ofToString(p.b)+ " " );
		dataBuffer.append(ofToString(p.a)+ " " );
		dataBuffer.append(ofToString(p.u1)+ " " );
		dataBuffer.append(ofToString(p.u2)+ "\n" );
	}*/
	
	//bool fileWritten = ofBufferToFile("etherdream.txt", dataBuffer);
	//
	
    // DODGY HACK: casting ofxIlda::Point* to etherdream_point*
    int res = etherdream_write(device, (etherdream_point*)points.data(), points.size(), pps, -1);
    if (res != 0) {
        ofLogVerbose() << "ofxEtherdream::write " << res;
    }
    points.clear();
}
Beispiel #2
0
int main(int argc, char **argv) {
	etherdream_lib_start();

	/* Sleep for a bit over a second, to ensure that we see broadcasts
	 * from all available DACs. */
	usleep(1200000);

	int cc = etherdream_dac_count();
	if (!cc) {
		printf("No DACs found.\n");
		return 0;
	}

	int mode;
	if (argc > 1)
		mode = atoi(argv[1]);
	else
		mode = 0;

	int i;
	for (i = 0; i < cc; i++) {
		printf("%d: Ether Dream %06lx\n", i,
			etherdream_get_id(etherdream_get(i)));
	}

	struct etherdream *d = etherdream_get(0);

	printf("Connecting...\n");
	if (etherdream_connect(d) < 0)
		return 1;

	i = 0;
	while (1) {
		fill_circle((float)i / 50, mode);
		int res = etherdream_write(d, circle, CIRCLE_POINTS, 30000, 1);
		if (res != 0) {
			printf("write %d\n", res);
		}
		etherdream_wait_for_ready(d);
		i++;
	}

	printf("done\n");
	return 0;
}