示例#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);
}
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);
}
示例#4
0
void
IedConnection_connect(IedConnection self, IedClientError* error, char* hostname, int tcpPort)
{
    MmsError mmsError;

    if (IedConnection_getState(self) != IED_STATE_CONNECTED) {

        MmsConnection_setConnectionLostHandler(self->connection, connectionLostHandler, (void*) self);
        MmsConnection_setInformationReportHandler(self->connection, informationReportHandler, self);

        if (MmsConnection_connect(self->connection, &mmsError, hostname, tcpPort)) {
            *error = IED_ERROR_OK;
            IedConnection_setState(self, IED_STATE_CONNECTED);
        }
        else {
            *error = iedConnection_mapMmsErrorToIedError(mmsError);
            MmsConnection_destroy(self->connection);
            self->connection = NULL;
        }
    }
    else
        *error = IED_ERROR_ALREADY_CONNECTED;
}
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);
}