Example #1
0
int main(int argc, char** argv) {

	MmsConnection con = MmsConnection_create();

	MmsIndication indication =
			MmsConnection_connect(con, "localhost", 102);

	if (indication == MMS_OK) {
		// add application code here
	}

	MmsConnection_destroy(con);
}
Example #2
0
IedConnection
IedConnection_create()
{
    IedConnection self = (IedConnection) calloc(1, sizeof(struct sIedConnection));

    self->enabledReports = LinkedList_create();
    self->logicalDevices = NULL;
    self->clientControls = LinkedList_create();

    self->connection = MmsConnection_create();

    self->state = IED_STATE_IDLE;

    self->stateMutex = Semaphore_create(1);

    return self;
}
int main(int argc, char** argv) {

	char* hostname;
	char* variable;
	int tcpPort = 102;
//	char varname; //variable for searching with just the name 
	variable = argv[1];

	if (argc > 2)
		hostname = argv[2];
	else
		hostname = "localhost";

	if (argc > 3)
		tcpPort = atoi(argv[3]);

//	if (argc > 4)
//		varname = atoi(argv[4]); // varname is the 4th command given when client is run

	MmsConnection con = MmsConnection_create();

	MmsError error;

	if (!MmsConnection_connect(con, &error, hostname, tcpPort)) {
  		printf("MMS connect failed!\n");
		goto exit;
	}
	else
		printf("MMS connected.\n\n");

	//MmsValue* value = MmsConnection_readVariable(con, &error, "simpleIOGenericIO", variable);

	 MmsValue* value = IedConnection_readObject(con, &error, "SampleIEDDevice1/MMXN1.Vol.mag.f");

	if (value == NULL)
		printf("reading value failed!\n");
	else {
		float fval = MmsValue_toFloat(value);
            	printf("read float value: %f\n", fval);
		MmsValue_delete(value);
	}

exit:
	MmsConnection_destroy(con);
}
int main(int argc, char** argv) {

	MmsConnection con = MmsConnection_create();

	MmsError mmsError;

	if (MmsConnection_connect(con, &mmsError, "localhost", 102)) {
		// add application code here

        Thread_sleep(1000);

	    printf("Send abort\n");
	    MmsConnection_abort(con, &mmsError);
	}
	else
	    printf("Connect to server failed!\n");

	MmsConnection_destroy(con);
}
int main(int argc, char** argv) {

	char* hostname;
	int tcpPort = 102;

	if (argc > 1)
		hostname = argv[1];
	else
		hostname = "localhost";

	if (argc > 2)
		tcpPort = atoi(argv[2]);

	MmsConnection con = MmsConnection_create();

	MmsIndication indication;

	indication = MmsConnection_connect(con, hostname, tcpPort);

	if (indication != MMS_OK) {
		printf("MMS connect failed!\n");
		goto exit;
	}
	else
		printf("MMS connected.\n\n");

	printf("Domains present on server:\n--------------------------\n");
	LinkedList nameList = MmsConnection_getDomainNames(con);
	LinkedList_printStringList(nameList);
	LinkedList_destroy(nameList);
	printf("\n");


exit:
	MmsConnection_destroy(con);
}