mglMetal Coding Conventions

This page provides some background on coding conventions used in mglMetal

Adding new commands

If you want to add a new command, you will generally make an m file which will communicate with the mglMetal application using the mglSockets commands. Here is a basic template which just reads a integer value from the mglMetal application

function [ackTime, processedTime] = mglGetSomeInfo()
 
% get socket
global mgl;
socketInfo = mgl.activeSockets;
 
% send line command
mglSocketWrite(socketInfo, socketInfo(1).command.mglGetSomeInfo);
ackTime = mglSocketRead(socketInfo, 'double');
 
% read an integer
someInfo = mglSocketRead(socketInfo,'uint32');
 
processedTime = mglSocketRead(socketInfo, 'double');

You will notice that the function sends a command as socketInfo(1).command.mglGetSomeInfo. This is an integer value which is defined in the header mglCommandTypes.h. You will need to define that constant in the list (actually three places). If it is a drawing command for the screen, make sure you add it before mglDrawingCommands in the list - otherwise, before. You will need to compile the socket code again:

mglMakeSocket