muntoo wrote:On the October 16, 2010 test release of BricxCC, I get a compile error with the following code:
Code: Select all
while(SendRemoteString(conn, queue, szSend) == STAT_COMM_PENDING);
Yes, I broke that accidentally. I have fixed the problem and will upload a new test release later today.
It was broken as a result of the substantial changes I made to the API header files in order to unify sending direct and system commands and bool, number, and string values from one NXT to another over Bluetooth and RS485 connections.
In the latest test release all the Remote* and SendRemote* API functions work with both Bluetooth and RS485 connections. You can specify the connection number (now) as a variable or a constant. There are new predefined connection number constants: CONN_BT0, CONN_BT1, CONN_BT2, CONN_BT3, and CONN_RS4. To send via the hi-speed RS485 port you use CONN_RS4 which is equal to the number 4. If you target the standard firmware you do not get the RS485 support.
The test release includes the following new Remote* API functions:
Code: Select all
inline bool RemoteConnectionIdle(byte conn);
inline char RemoteConnectionWrite(byte conn, byte buffer[]);
inline char RemoteGetBatteryLevel(byte conn);
inline char RemoteLowspeedGetStatus(byte conn);
inline char RemoteGetCurrentProgramName(byte conn);
inline char RemoteGetContactCount(byte conn);
inline char RemoteGetConnectionCount(byte conn);
inline char RemoteGetOutputState(byte conn, byte port);
inline char RemoteGetInputValues(byte conn, byte port);
inline char RemoteLowspeedRead(byte conn, byte port);
inline char RemoteResetTachoCount(byte conn, byte port);
inline char RemoteGetProperty(byte conn, byte property);
inline char RemoteDatalogRead(byte conn, bool remove);
inline char RemoteBTGetContactName(byte conn, byte idx);
inline char RemoteBTGetConnectionName(byte conn, byte idx);
inline char RemoteDatalogSetTimes(byte conn, long synctime);
inline char RemoteSetProperty(byte conn, byte prop, variant value);
inline char RemoteLowspeedWrite(byte conn, byte port, byte txlen, byte rxlen, byte data[]);
inline char RemoteOpenRead(byte conn, string filename);
inline char RemoteOpenAppendData(byte conn, string filename);
inline char RemoteDeleteFile(byte conn, string filename);
inline char RemoteFindFirstFile(byte conn, string mask);
inline char RemoteGetFirmwareVersion(byte conn);
inline char RemoteGetBluetoothAddress(byte conn);
inline char RemoteGetDeviceInfo(byte conn);
inline char RemoteDeleteUserFlash(byte conn);
inline char RemoteBluetoothFactoryReset(byte conn);
inline char RemoteOpenWrite(byte conn, string filename, long size);
inline char RemoteOpenWriteLinear(byte conn, string filename, long size);
inline char RemoteOpenWriteData(byte conn, string filename, long size);
inline char RemoteCloseFile(byte conn, byte handle);
inline char RemoteFindNextFile(byte conn, byte handle);
inline char RemotePollCommandLength(byte conn, byte bufnum);
inline char RemoteWrite(byte conn, byte handle, byte data[]);
inline char RemoteRead(byte conn, byte handle, byte numbytes);
inline char RemoteIOMapRead(byte conn, long id, int offset, int numbytes);
inline char RemoteIOMapWriteValue(byte conn, long id, int offset, variant value);
inline char RemoteIOMapWriteBytes(byte conn, long id, int offset, byte data[]);
inline char RemoteSetBrickName(byte conn, string name);
inline char RemoteRenameFile(byte conn, string oldname, string newname);
inline char RemotePollCommand(byte conn, byte bufnum, byte len);
The signature and behavior of several of these functions may change before the next official release since right now they send the command and do nothing about reading the response packet. It may be worth the extra effort to add to these functions the receiving side of the equation (so long as you have the enhanced firmware on your NXT). If I do that then the functions that process the response will probably return a structure containing the response data.
John Hansen