[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/rincon/apps/Blackbook5/apps/BlackbookDictionaryConnect
BlackbookDictionaryConnectM.nc, NONE,
1.1 BlackbookDictionaryConnectC.nc, NONE, 1.1 readme.txt, NONE,
1.1 Makefile, NONE, 1.1 BlackbookDictionaryConnect.h, NONE, 1.1
dmm
rincon at users.sourceforge.net
Thu May 18 15:34:22 PDT 2006
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/rincon/apps/Blackbook5/apps/BlackbookFullConnect/messages
BlackbookFileMsg.java, NONE, 1.1 BlackbookConnectMsg.java,
NONE, 1.1 BlackbookSectorMsg.java, NONE,
1.1 BlackbookNodeMsg.java, NONE, 1.1
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/rincon/apps/Blackbook5/apps/StandaloneFull
Makefile, NONE, 1.1 TestBlackbookFullC.nc, NONE,
1.1 readme.txt, NONE, 1.1 TestBlackbookFullM.nc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/apps/BlackbookDictionaryConnect
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14770/contrib/rincon/apps/Blackbook5/apps/BlackbookDictionaryConnect
Added Files:
BlackbookDictionaryConnectM.nc BlackbookDictionaryConnectC.nc
readme.txt Makefile BlackbookDictionaryConnect.h
Log Message:
Uploaded Initial Blackbook5
--- NEW FILE: BlackbookDictionaryConnectM.nc ---
/*
* Copyright (c) 2004-2006 Rincon Research Corporation.
* All rights reserved.
*
* Rincon Research will permit distribution and use by others subject to
* the restrictions of a licensing agreement which contains (among other things)
* the following restrictions:
*
* 1. No credit will be taken for the Work of others.
* 2. It will not be resold for a price in excess of reproduction and
* distribution costs.
* 3. Others are not restricted from copying it or using it except as
* set forward in the licensing agreement.
* 4. Commented source code of any modifications or additions will be
* made available to Rincon Research on the same terms.
* 5. This notice will remain intact and displayed prominently.
*
* Copies of the complete licensing agreement may be obtained by contacting
* Rincon Research, 101 N. Wilmot, Suite 101, Tucson, AZ 85711.
*
* There is no warranty with this product, either expressed or implied.
* Use at your own risk. Rincon Research is not liable or responsible for
* damage or loss incurred or resulting from the use or misuse of this software.
*/
/**
* Test Blackbook
* @author David Moss - dmm at rincon.com
*/
includes Blackbook;
includes BlackbookDictionaryConnect;
module BlackbookDictionaryConnectM {
provides {
interface StdControl;
}
uses {
interface BBoot;
interface BClean;
interface BFileDelete;
interface BFileDir;
interface BDictionary;
interface Transceiver;
interface Transceiver as NodeTransceiver;
interface Transceiver as FileTransceiver;
interface Transceiver as SectorTransceiver;
interface NodeMap;
interface SectorMap;
interface State;
interface Leds;
}
}
implementation {
/** The communication method the last message was received */
uint8_t receiveMethod;
/** TOS Message to write */
TOS_MsgPtr tosPtr;
/** Message payload to send */
BlackbookConnectMsg *outMsg;
/** Receive methods */
enum {
RADIO,
UART,
};
/** States */
enum {
S_IDLE = 0,
S_BUSY,
};
/***************** Prototypes ****************/
/** Process an incoming message */
TOS_MsgPtr processMsg(TOS_MsgPtr m);
/** Make a new message */
result_t newMessage();
/** Send the message */
void sendMsg();
/***************** StdControl Commands ****************/
command result_t StdControl.init() {
call Leds.init();
return SUCCESS;
}
command result_t StdControl.start() {
call Leds.redOn();
return SUCCESS;
}
command result_t StdControl.stop() {
return SUCCESS;
}
/***************** Transceiver Events ****************/
/**
* A message was sent over radio.
* @param m - a pointer to the sent message, valid for the duration of the
* event.
* @param result - SUCCESS or FAIL.
*/
event result_t Transceiver.radioSendDone(TOS_MsgPtr m, result_t result) {
return SUCCESS;
}
/**
* A message was sent over UART.
* @param m - a pointer to the sent message, valid for the duration of the
* event.
* @param result - SUCCESS or FAIL.
*/
event result_t Transceiver.uartSendDone(TOS_MsgPtr m, result_t result) {
return SUCCESS;
}
/**
* Received a message over the radio
* @param m - the receive message, valid for the duration of the
* event.
*/
event TOS_MsgPtr Transceiver.receiveRadio(TOS_MsgPtr m) {
receiveMethod = RADIO;
return processMsg(m);
}
/**
* Received a message over UART
* @param m - the receive message, valid for the duration of the
* event.
*/
event TOS_MsgPtr Transceiver.receiveUart(TOS_MsgPtr m) {
receiveMethod = UART;
return processMsg(m);
}
/***************** NodeTransceiver ****************/
/**
* Received a message over UART
* @param m - the receive message, valid for the duration of the
* event.
*/
event TOS_MsgPtr NodeTransceiver.receiveUart(TOS_MsgPtr m) {
TOS_MsgPtr nodeTosPtr;
BlackbookNodeMsg *nodeOutMsg;
BlackbookNodeMsg *inMsg = (BlackbookNodeMsg *) m->data;
if((nodeTosPtr = call NodeTransceiver.requestWrite()) != NULL) {
nodeOutMsg = (BlackbookNodeMsg *) nodeTosPtr->data;
memcpy(&nodeOutMsg->focusedNode, call NodeMap.getNodeAtIndex(inMsg->focusedNode.state), sizeof(node));
call NodeTransceiver.sendUart(sizeof(BlackbookNodeMsg));
}
return m;
}
/**
* A message was sent over radio.
* @param m - a pointer to the sent message, valid for the duration of the
* event.
* @param result - SUCCESS or FAIL.
*/
event result_t NodeTransceiver.radioSendDone(TOS_MsgPtr m, result_t result) {
return SUCCESS;
}
/**
* A message was sent over UART.
* @param m - a pointer to the sent message, valid for the duration of the
* event.
* @param result - SUCCESS or FAIL.
*/
event result_t NodeTransceiver.uartSendDone(TOS_MsgPtr m, result_t result) {
return SUCCESS;
}
/**
* Received a message over the radio
* @param m - the receive message, valid for the duration of the
* event.
*/
event TOS_MsgPtr NodeTransceiver.receiveRadio(TOS_MsgPtr m) {
return m;
}
/***************** File Transceiver *****************/
/**
* Received a message over UART
* @param m - the receive message, valid for the duration of the
* event.
*/
event TOS_MsgPtr FileTransceiver.receiveUart(TOS_MsgPtr m) {
TOS_MsgPtr fileTosPtr;
BlackbookFileMsg *fileOutMsg;
BlackbookFileMsg *inMsg = (BlackbookFileMsg *) m->data;
if((fileTosPtr = call FileTransceiver.requestWrite()) != NULL) {
fileOutMsg = (BlackbookFileMsg *) fileTosPtr->data;
memcpy(&fileOutMsg->focusedFile, call NodeMap.getFileAtIndex(inMsg->focusedFile.state), sizeof(file));
call FileTransceiver.sendUart(sizeof(BlackbookFileMsg));
}
return m;
}
/**
* A message was sent over radio.
* @param m - a pointer to the sent message, valid for the duration of the
* event.
* @param result - SUCCESS or FAIL.
*/
event result_t FileTransceiver.radioSendDone(TOS_MsgPtr m, result_t result) {
return SUCCESS;
}
/**
* A message was sent over UART.
* @param m - a pointer to the sent message, valid for the duration of the
* event.
* @param result - SUCCESS or FAIL.
*/
event result_t FileTransceiver.uartSendDone(TOS_MsgPtr m, result_t result) {
return SUCCESS;
}
/**
* Received a message over the radio
* @param m - the receive message, valid for the duration of the
* event.
*/
event TOS_MsgPtr FileTransceiver.receiveRadio(TOS_MsgPtr m) {
return m;
}
/***************** Sector Transceiver ****************/
/**
* Received a message over UART
* @param m - the receive message, valid for the duration of the
* event.
*/
event TOS_MsgPtr SectorTransceiver.receiveUart(TOS_MsgPtr m) {
TOS_MsgPtr sectorTosPtr;
BlackbookSectorMsg *sectorOutMsg;
BlackbookSectorMsg *inMsg = (BlackbookSectorMsg *) m->data;
if((sectorTosPtr = call SectorTransceiver.requestWrite()) != NULL) {
sectorOutMsg = (BlackbookSectorMsg *) sectorTosPtr->data;
memcpy(§orOutMsg->focusedSector, call SectorMap.getSectorAtVolume(inMsg->focusedSector.index), sizeof(flashsector));
call SectorTransceiver.sendUart(sizeof(BlackbookSectorMsg));
}
return m;
}
/**
* A message was sent over radio.
* @param m - a pointer to the sent message, valid for the duration of the
* event.
* @param result - SUCCESS or FAIL.
*/
event result_t SectorTransceiver.radioSendDone(TOS_MsgPtr m, result_t result) {
return SUCCESS;
}
/**
* A message was sent over UART.
* @param m - a pointer to the sent message, valid for the duration of the
* event.
* @param result - SUCCESS or FAIL.
*/
event result_t SectorTransceiver.uartSendDone(TOS_MsgPtr m, result_t result) {
return SUCCESS;
}
/**
* Received a message over the radio
* @param m - the receive message, valid for the duration of the
* event.
*/
event TOS_MsgPtr SectorTransceiver.receiveRadio(TOS_MsgPtr m) {
return m;
}
/***************** BBoot Events ****************/
/**
* The file system finished booting
* @param totalNodes - the total number of nodes found on flash
* @param result - SUCCESS if the file system is ready for use.
*/
event void BBoot.booted(uint16_t totalNodes, uint8_t totalFiles, result_t result) {
call Leds.redOff();
call Leds.yellowOn();
if(newMessage()) {
outMsg->cmd = REPLY_BOOT;
outMsg->length = totalNodes;
outMsg->data[0] = totalFiles;
outMsg->result = result;
sendMsg();
}
}
/***************** BClean Events ****************/
/**
* The Garbage Collector is erasing a sector - this may take awhile
*/
event void BClean.erasing() {
call Leds.yellowOff();
if(newMessage()) {
outMsg->cmd = REPLY_BCLEAN_ERASING;
sendMsg();
}
}
/**
* Garbage Collection is complete
* @return SUCCESS if any sectors were erased.
*/
event void BClean.gcDone(result_t result) {
call Leds.yellowOn();
if(newMessage()) {
outMsg->cmd = REPLY_BCLEAN_DONE;
outMsg->result = result;
sendMsg();
}
}
/***************** BFileDelete Events ****************/
/**
* A file was deleted
* @param result - SUCCESS if the file was deleted from flash
*/
event void BFileDelete.deleted(result_t result) {
outMsg->result = result;
outMsg->cmd = REPLY_BFILEDELETE_DELETE;
sendMsg();
}
/***************** BFileDir Events ****************/
/**
* The corruption check on a file is complete
* @param fileName - the name of the file that was checked
* @param isCorrupt - TRUE if the file's actual data does not match its CRC
* @param result - SUCCESS if this information is valid.
*/
event void BFileDir.corruptionCheckDone(char *fileName, bool isCorrupt, result_t result) {
outMsg->result = result;
outMsg->length = isCorrupt;
outMsg->cmd = REPLY_BFILEDIR_CHECKCORRUPTION;
sendMsg();
}
/**
* The check to see if a file exists is complete
* @param fileName - the name of the file
* @param doesExist - TRUE if the file exists
* @param result - SUCCESS if this information is valid
*/
event void BFileDir.existsCheckDone(char *fileName, bool doesExist, result_t result) {
outMsg->result = result;
outMsg->length = doesExist;
outMsg->cmd = REPLY_BFILEDIR_EXISTS;
sendMsg();
}
/**
* This is the next file in the file system after the given
* present file.
* @param fileName - name of the next file
* @param result - SUCCESS if this is actually the next file,
* FAIL if the given present file is not valid or there is no
* next file.
*/
event void BFileDir.nextFile(char *fileName, result_t result) {
memcpy(outMsg->data, fileName, sizeof(filename));
outMsg->result = result;
outMsg->cmd = REPLY_BFILEDIR_READNEXT;
sendMsg();
}
/***************** BDictionary Events ****************/
/**
* A Dictionary file was opened successfully.
* @param totalSize - the total amount of flash space dedicated to storing
* key-value pairs in the file
* @param remainingBytes - the remaining amount of space left to write to
* @param result - SUCCESS if the file was successfully opened.
*/
event void BDictionary.opened(uint32_t totalSize, uint32_t remainingBytes, result_t result) {
outMsg->length = totalSize;
outMsg->result = result;
outMsg->cmd = REPLY_BDICTIONARY_OPEN;
sendMsg();
}
/**
* @param isDictionary - TRUE if the file is a dictionary
* @param result - SUCCESS if the reading is valid
*/
event void BDictionary.fileIsDictionary(bool isDictionary, result_t result) {
outMsg->length = isDictionary;
outMsg->result = result;
outMsg->cmd = REPLY_BDICTIONARY_ISDICTIONARY;
sendMsg();
}
/**
* The opened Dictionary file is now closed
* @param result - SUCCSESS if there are no open files
*/
event void BDictionary.closed(result_t result) {
outMsg->result = result;
outMsg->cmd = REPLY_BDICTIONARY_CLOSE;
sendMsg();
}
/**
* A key-value pair was inserted into the currently opened Dictionary file.
* @param key - the key used to insert the value
* @param value - pointer to the buffer containing the value.
* @param valueSize - the amount of bytes copied from the buffer into flash
* @param result - SUCCESS if the key was written successfully.
*/
event void BDictionary.inserted(uint32_t key, void *value, uint16_t valueSize, result_t result) {
outMsg->result = result;
outMsg->length = key;
outMsg->cmd = REPLY_BDICTIONARY_INSERT;
sendMsg();
}
/**
* A value was retrieved from the given key.
* @param key - the key used to find the value
* @param valueHolder - pointer to the buffer where the value was stored
* @param valueSize - the actual size of the value.
* @param result - SUCCESS if the value was pulled out and is uncorrupted
*/
event void BDictionary.retrieved(uint32_t key, void *valueHolder, uint16_t valueSize, result_t result) {
outMsg->result = result;
outMsg->length = valueSize;
outMsg->cmd = REPLY_BDICTIONARY_RETRIEVE;
sendMsg();
}
/**
* A key-value pair was removed
* @param key - the key that should no longer exist
* @param result - SUCCESS if the key was really removed
*/
event void BDictionary.removed(uint32_t key, result_t result) {
outMsg->result = result;
outMsg->length = key;
outMsg->cmd = REPLY_BDICTIONARY_REMOVE;
sendMsg();
}
/**
* The next key in the open Dictionary file
* @param nextKey - the next key
* @param result - SUCCESS if this is the really the next key,
* FAIL if the presentKey was invalid or there is no next key.
*/
event void BDictionary.nextKey(uint32_t nextKey, result_t result) {
outMsg->result = result;
outMsg->length = nextKey;
outMsg->cmd = REPLY_BDICTIONARY_NEXTKEY;
sendMsg();
}
/***************** Functions ****************/
/**
* Process the incoming message
*/
TOS_MsgPtr processMsg(TOS_MsgPtr m) {
BlackbookConnectMsg *inMsg = (BlackbookConnectMsg *) m->data;
if(!call State.requestState(S_BUSY)) {
return m;
}
if(!newMessage()) {
return m;
}
switch(inMsg->cmd) {
/** BFileWrite Commands */
case CMD_BFILEWRITE_OPEN:
outMsg->cmd = ERROR_BFILEWRITE_OPEN;
sendMsg();
break;
case CMD_BFILEWRITE_CLOSE:
outMsg->cmd = ERROR_BFILEWRITE_CLOSE;
sendMsg();
break;
case CMD_BFILEWRITE_APPEND:
outMsg->cmd = ERROR_BFILEWRITE_APPEND;
sendMsg();
break;
case CMD_BFILEWRITE_SAVE:
outMsg->cmd = ERROR_BFILEWRITE_SAVE;
sendMsg();
break;
case CMD_BFILEWRITE_REMAINING:
outMsg->cmd = ERROR_BFILEWRITE_REMAINING;
sendMsg();
break;
/** BFileRead Commands */
case CMD_BFILEREAD_OPEN:
outMsg->cmd = ERROR_BFILEREAD_OPEN;
sendMsg();
break;
case CMD_BFILEREAD_CLOSE:
outMsg->cmd = ERROR_BFILEREAD_CLOSE;
sendMsg();
break;
case CMD_BFILEREAD_READ:
outMsg->cmd = ERROR_BFILEREAD_READ;
sendMsg();
break;
case CMD_BFILEREAD_SEEK:
outMsg->cmd = ERROR_BFILEREAD_SEEK;
break;
case CMD_BFILEREAD_SKIP:
outMsg->cmd = ERROR_BFILEREAD_SKIP;
break;
case CMD_BFILEREAD_REMAINING:
outMsg->cmd = ERROR_BFILEREAD_REMAINING;
sendMsg();
break;
/** BFileDelete Commands */
case CMD_BFILEDELETE_DELETE:
if(!call BFileDelete.delete((char *) inMsg->data)) {
outMsg->cmd = ERROR_BFILEDELETE_DELETE;
sendMsg();
}
break;
/** BFileDir Commands */
case CMD_BFILEDIR_TOTALFILES:
outMsg->length = call BFileDir.getTotalFiles();
outMsg->cmd = REPLY_BFILEDIR_TOTALFILES;
sendMsg();
break;
case CMD_BFILEDIR_TOTALNODES:
outMsg->length = call BFileDir.getTotalNodes();
outMsg->cmd = REPLY_BFILEDIR_TOTALNODES;
sendMsg();
break;
case CMD_BFILEDIR_GETFREESPACE:
outMsg->length = call BFileDir.getFreeSpace();
outMsg->cmd = REPLY_BFILEDIR_GETFREESPACE;
sendMsg();
break;
case CMD_BFILEDIR_EXISTS:
if(!call BFileDir.checkExists((char *) inMsg->data)) {
outMsg->cmd = ERROR_BFILEDIR_EXISTS;
sendMsg();
}
break;
case CMD_BFILEDIR_READNEXT:
if(!call BFileDir.readNext((char *) inMsg->data)) {
outMsg->cmd = ERROR_BFILEDIR_READNEXT;
sendMsg();
}
break;
case CMD_BFILEDIR_READFIRST:
if(!call BFileDir.readFirst()) {
outMsg->cmd = ERROR_BFILEDIR_READFIRST;
sendMsg();
}
break;
case CMD_BFILEDIR_RESERVEDLENGTH:
outMsg->length = call BFileDir.getReservedLength((char *) inMsg->data);
outMsg->cmd = REPLY_BFILEDIR_RESERVEDLENGTH;
sendMsg();
break;
case CMD_BFILEDIR_DATALENGTH:
outMsg->length = call BFileDir.getDataLength((char *) inMsg->data);
outMsg->cmd = REPLY_BFILEDIR_DATALENGTH;
sendMsg();
break;
case CMD_BFILEDIR_CHECKCORRUPTION:
if(!call BFileDir.checkCorruption((char *) inMsg->data)) {
outMsg->cmd = ERROR_BFILEDIR_CHECKCORRUPTION;
sendMsg();
}
break;
/** BDicitonary Commands */
case CMD_BDICTIONARY_OPEN:
if(!call BDictionary.open((char *) inMsg->data, inMsg->length)) {
outMsg->cmd = ERROR_BDICTIONARY_OPEN;
sendMsg();
}
break;
case CMD_BDICTIONARY_CLOSE:
if(!call BDictionary.close()) {
outMsg->cmd = ERROR_BDICTIONARY_CLOSE;
sendMsg();
}
break;
case CMD_BDICTIONARY_INSERT:
// length = key
// data = value
// result = valueSize
if(!call BDictionary.insert(inMsg->length, inMsg->data, inMsg->result)) {
outMsg->cmd = ERROR_BDICTIONARY_INSERT;
sendMsg();
}
break;
case CMD_BDICTIONARY_RETRIEVE:
if(!call BDictionary.retrieve(inMsg->length, outMsg->data, sizeof(outMsg->data))) {
outMsg->cmd = ERROR_BDICTIONARY_RETRIEVE;
sendMsg();
}
break;
case CMD_BDICTIONARY_REMOVE:
if(!call BDictionary.remove(inMsg->length)) {
outMsg->cmd = ERROR_BDICTIONARY_REMOVE;
sendMsg();
}
break;
case CMD_BDICTIONARY_NEXTKEY:
if(!call BDictionary.getNextKey(inMsg->length)) {
outMsg->cmd = ERROR_BDICTIONARY_NEXTKEY;
sendMsg();
}
break;
case CMD_BDICTIONARY_FIRSTKEY:
if(!call BDictionary.getFirstKey()) {
outMsg->cmd = ERROR_BDICTIONARY_FIRSTKEY;
sendMsg();
}
break;
case CMD_BDICTIONARY_ISDICTIONARY:
if(!call BDictionary.isFileDictionary((char *) inMsg->data)) {
outMsg->cmd = ERROR_BDICTIONARY_ISDICTIONARY;
sendMsg();
}
break;
default:
}
return m;
}
/**
* Create a new message
*/
result_t newMessage() {
if((tosPtr = call Transceiver.requestWrite()) != NULL) {
outMsg = (BlackbookConnectMsg *) tosPtr->data;
memset(outMsg->data, 0, sizeof(outMsg->data));
return SUCCESS;
}
return FAIL;
}
/**
* Send the message
*/
void sendMsg() {
call State.toIdle();
if(receiveMethod == RADIO) {
call Transceiver.sendRadio(TOS_BCAST_ADDR, sizeof(BlackbookConnectMsg));
} else {
call Transceiver.sendUart(sizeof(BlackbookConnectMsg));
}
}
}
--- NEW FILE: BlackbookDictionaryConnectC.nc ---
/*
* Copyright (c) 2004-2006 Rincon Research Corporation.
* All rights reserved.
*
* Rincon Research will permit distribution and use by others subject to
* the restrictions of a licensing agreement which contains (among other things)
* the following restrictions:
*
* 1. No credit will be taken for the Work of others.
* 2. It will not be resold for a price in excess of reproduction and
* distribution costs.
* 3. Others are not restricted from copying it or using it except as
* set forward in the licensing agreement.
* 4. Commented source code of any modifications or additions will be
* made available to Rincon Research on the same terms.
* 5. This notice will remain intact and displayed prominently.
*
* Copies of the complete licensing agreement may be obtained by contacting
* Rincon Research, 101 N. Wilmot, Suite 101, Tucson, AZ 85711.
*
* There is no warranty with this product, either expressed or implied.
* Use at your own risk. Rincon Research is not liable or responsible for
* damage or loss incurred or resulting from the use or misuse of this software.
*/
/**
* BlackbookDictionaryConnect Module
* This interacts with the com.rincon.blackbook.BlackbookDictionaryConnect
* program to provide direct access to the Blackbook interfaces
* from your desktop.
*
* You can also use com.rincon.blackbook.memorystick.MemoryStick
* to upload/download files on your computer to flash.
*
* @author David Moss - dmm at rincon.com
*/
includes Blackbook;
includes BlackbookDictionaryConnect;
configuration BlackbookDictionaryConnectC {
}
implementation {
components Main, BlackbookDictionaryConnectM, BlackbookDictionaryC, FlashBridgeViewerC, StateC, TransceiverC, LedsC;
components NodeMapC, SectorMapC;
Main.StdControl -> BlackbookDictionaryConnectM;
Main.StdControl -> BlackbookDictionaryC;
Main.StdControl -> FlashBridgeViewerC;
Main.StdControl -> TransceiverC;
Main.StdControl -> StateC;
BlackbookDictionaryConnectM.Transceiver -> TransceiverC.Transceiver[AM_BLACKBOOKCONNECTMSG];
BlackbookDictionaryConnectM.NodeTransceiver -> TransceiverC.Transceiver[AM_BLACKBOOKNODEMSG];
BlackbookDictionaryConnectM.FileTransceiver -> TransceiverC.Transceiver[AM_BLACKBOOKFILEMSG];
BlackbookDictionaryConnectM.SectorTransceiver -> TransceiverC.Transceiver[AM_BLACKBOOKSECTORMSG];
BlackbookDictionaryConnectM.State -> StateC.State[unique("State")];
BlackbookDictionaryConnectM.Leds -> LedsC;
// This stuff is for debugging purposes.
BlackbookDictionaryConnectM.NodeMap -> NodeMapC;
BlackbookDictionaryConnectM.SectorMap -> SectorMapC;
// These are all the actual Blackbook interfaces you can wire up to your app.
BlackbookDictionaryConnectM.BBoot -> BlackbookDictionaryC;
BlackbookDictionaryConnectM.BClean -> BlackbookDictionaryC;
BlackbookDictionaryConnectM.BFileDelete -> BlackbookDictionaryC.BFileDelete[unique("BFileDelete")];
BlackbookDictionaryConnectM.BFileDir -> BlackbookDictionaryC.BFileDir[unique("BFileDir")];
BlackbookDictionaryConnectM.BDictionary -> BlackbookDictionaryC.BDictionary[unique("BDictionary")];
}
--- NEW FILE: readme.txt ---
BlackbookConnect Dictionary-Only
Review the other readme's in the BlackbookFullConnect directory.
This is the application I used to debug Blackbook, but it does
everything you want it to. You can use it
to see exactly how Blackbook works and what it does. It essentially
takes all the interfaces to Blackbook and makes them available
to you on the computer, so you can run commands from the computer
to the mote, just as if you were part of the mote itself. The
Java interfaces in the com.rincon.blackbook directory
are just like the interfaces you'd see on the mote itself.
When BlackbookConnect is compiled to the mote, a green LED means
the FlashBridgeViewer is running, and a yellow/blue LED means
the BlackbookConnect stuff is running. You'll see the yellow/blue
LED go off when a sector is being erased.
There are 3 basic chunks of functionality provided by BlackbookConnect:
1. Execute all commands and receive all events from all interfaces
provided by Blackbook on the computer.
2. View the status of all nodes, sectors, and file structs inside
Blackbook. This is useful mostly for debugging or to fill your
curiosity.
3. View the contents of the flash through the FlashBridgeViewer interface
to see what Blackbook is doing under the hood.
Two Java applications work with BlackbookConnect to show off the features.
You'll need to copy the com.rincon.<whatever> directories into your own
tinyos-1.x/tools/java directory. These apps will interact
with BlackbookConnect:
com.rincon.blackbook.BlackbookConnect
com.rincon.blackbook.memorystick.MemoryStick
com.rincon.blackbook.printstatus.PrintFile
com.rincon.blackbook.printstatus.PrintNode
com.rincon.blackbook.printstatus.PrintSector
com.rincon.flashbridgeviewer.FlashViewer
Read the "blackbookconnect_readme.txt" for information
and a walk through of all the stuff you can do with the Blackbook
interfaces from your desktop.
Read the "memorystick_readme.txt" for information and a walk
through of all the stuff you can do with the MemoryStick application
Shoot me some feedback on how this stuff works out for you. Enjoy...
@author David Moss (dmm at rincon.com)
_____________________________________________________________________
com.rincon.blackbook.BlackbookConnect
--- NEW FILE: Makefile ---
COMPONENT=BlackbookDictionaryConnectC
# Choose one:
#CFLAGS += -I../../media/AT45DB
CFLAGS += -I../../media/STM25P
CFLAGS += -I../../ -I../../core -I../../interfaces -I../../boot
CFLAGS += -I../FlashBridgeViewer
CFLAGS += -Os
CFLAGS += -I../../../../tos/lib/State -I../../../../tos/lib/Transceiver
include $(TOSROOT)/apps/Makerules
--- NEW FILE: BlackbookDictionaryConnect.h ---
/*
* Copyright (c) 2004-2006 Rincon Research Corporation.
* All rights reserved.
*
* Rincon Research will permit distribution and use by others subject to
* the restrictions of a licensing agreement which contains (among other things)
* the following restrictions:
*
* 1. No credit will be taken for the Work of others.
* 2. It will not be resold for a price in excess of reproduction and
* distribution costs.
* 3. Others are not restricted from copying it or using it except as
* set forward in the licensing agreement.
* 4. Commented source code of any modifications or additions will be
* made available to Rincon Research on the same terms.
* 5. This notice will remain intact and displayed prominently.
*
* Copies of the complete licensing agreement may be obtained by contacting
* Rincon Research, 101 N. Wilmot, Suite 101, Tucson, AZ 85711.
*
* There is no warranty with this product, either expressed or implied.
* Use at your own risk. Rincon Research is not liable or responsible for
* damage or loss incurred or resulting from the use or misuse of this software.
*/
#include "AM.h"
typedef struct BlackbookConnectMsg {
uint32_t length;
uint8_t cmd;
uint8_t result;
uint8_t data[TOSH_DATA_LENGTH - 6];
} BlackbookConnectMsg;
typedef struct BlackbookNodeMsg {
struct node focusedNode;
} BlackbookNodeMsg;
typedef struct BlackbookFileMsg {
struct file focusedFile;
} BlackbookFileMsg;
typedef struct BlackbookSectorMsg {
struct flashsector focusedSector;
} BlackbookSectorMsg;
enum {
AM_BLACKBOOKCONNECTMSG = 0xBB,
AM_BLACKBOOKNODEMSG = 0xBC,
AM_BLACKBOOKFILEMSG = 0xBD,
AM_BLACKBOOKSECTORMSG = 0xBE,
};
enum {
CMD_BFILEWRITE_OPEN = 0,
CMD_BFILEWRITE_CLOSE = 1,
CMD_BFILEWRITE_APPEND = 2,
CMD_BFILEWRITE_SAVE = 3,
CMD_BFILEWRITE_REMAINING = 4,
CMD_BFILEREAD_OPEN = 10,
CMD_BFILEREAD_CLOSE = 11,
CMD_BFILEREAD_READ = 12,
CMD_BFILEREAD_SEEK = 13,
CMD_BFILEREAD_SKIP = 14,
CMD_BFILEREAD_REMAINING = 15,
CMD_BFILEDELETE_DELETE = 20,
CMD_BFILEDIR_TOTALFILES = 30,
CMD_BFILEDIR_TOTALNODES = 31,
CMD_BFILEDIR_EXISTS = 32,
CMD_BFILEDIR_READNEXT = 33,
CMD_BFILEDIR_RESERVEDLENGTH = 34,
CMD_BFILEDIR_DATALENGTH = 35,
CMD_BFILEDIR_CHECKCORRUPTION = 36,
CMD_BFILEDIR_READFIRST = 37,
CMD_BFILEDIR_GETFREESPACE = 38,
CMD_BDICTIONARY_OPEN = 40,
CMD_BDICTIONARY_CLOSE = 41,
CMD_BDICTIONARY_INSERT = 42,
CMD_BDICTIONARY_RETRIEVE = 43,
CMD_BDICTIONARY_REMOVE = 44,
CMD_BDICTIONARY_NEXTKEY = 45,
CMD_BDICTIONARY_FIRSTKEY = 46,
CMD_BDICTIONARY_ISDICTIONARY = 47,
ERROR_BFILEWRITE_OPEN = 100,
ERROR_BFILEWRITE_CLOSE = 101,
ERROR_BFILEWRITE_APPEND = 102,
ERROR_BFILEWRITE_SAVE = 103,
ERROR_BFILEWRITE_REMAINING = 104,
ERROR_BFILEREAD_OPEN = 110,
ERROR_BFILEREAD_CLOSE = 111,
ERROR_BFILEREAD_READ = 112,
ERROR_BFILEREAD_SEEK = 113,
ERROR_BFILEREAD_SKIP = 114,
ERROR_BFILEREAD_REMAINING = 115,
ERROR_BFILEDELETE_DELETE = 120,
ERROR_BFILEDIR_TOTALFILES = 130,
ERROR_BFILEDIR_TOTALNODES = 131,
ERROR_BFILEDIR_EXISTS = 132,
ERROR_BFILEDIR_READNEXT = 133,
ERROR_BFILEDIR_RESERVEDLENGTH = 134,
ERROR_BFILEDIR_DATALENGTH = 135,
ERROR_BFILEDIR_CHECKCORRUPTION = 136,
ERROR_BFILEDIR_READFIRST = 137,
ERROR_BFILEDIR_GETFREESPACE = 138,
ERROR_BDICTIONARY_OPEN = 140,
ERROR_BDICTIONARY_CLOSE = 141,
ERROR_BDICTIONARY_INSERT = 142,
ERROR_BDICTIONARY_RETRIEVE = 143,
ERROR_BDICTIONARY_REMOVE = 144,
ERROR_BDICTIONARY_NEXTKEY = 145,
ERROR_BDICTIONARY_FIRSTKEY = 146,
ERROR_BDICTIONARY_ISDICTIONARY = 147,
REPLY_BFILEWRITE_OPEN = 200,
REPLY_BFILEWRITE_CLOSE = 201,
REPLY_BFILEWRITE_APPEND = 202,
REPLY_BFILEWRITE_SAVE = 203,
REPLY_BFILEWRITE_REMAINING = 204,
REPLY_BFILEREAD_OPEN = 210,
REPLY_BFILEREAD_CLOSE = 211,
REPLY_BFILEREAD_READ = 212,
REPLY_BFILEREAD_SEEK = 213,
REPLY_BFILEREAD_SKIP = 214,
REPLY_BFILEREAD_REMAINING = 215,
REPLY_BFILEDELETE_DELETE = 220,
REPLY_BFILEDIR_TOTALFILES = 230,
REPLY_BFILEDIR_TOTALNODES = 231,
REPLY_BFILEDIR_EXISTS = 232,
REPLY_BFILEDIR_READNEXT = 233,
REPLY_BFILEDIR_RESERVEDLENGTH = 234,
REPLY_BFILEDIR_DATALENGTH = 235,
REPLY_BFILEDIR_CHECKCORRUPTION = 236,
REPLY_BFILEDIR_GETFREESPACE = 238,
REPLY_BDICTIONARY_OPEN = 240,
REPLY_BDICTIONARY_CLOSE = 241,
REPLY_BDICTIONARY_INSERT = 242,
REPLY_BDICTIONARY_RETRIEVE = 243,
REPLY_BDICTIONARY_REMOVE = 244,
REPLY_BDICTIONARY_NEXTKEY = 245,
REPLY_BDICTIONARY_FIRSTKEY = 246,
REPLY_BDICTIONARY_ISDICTIONARY = 247,
REPLY_BOOT = 250,
REPLY_BCLEAN_ERASING = 251,
REPLY_BCLEAN_DONE = 252,
};
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/rincon/apps/Blackbook5/apps/BlackbookFullConnect/messages
BlackbookFileMsg.java, NONE, 1.1 BlackbookConnectMsg.java,
NONE, 1.1 BlackbookSectorMsg.java, NONE,
1.1 BlackbookNodeMsg.java, NONE, 1.1
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/rincon/apps/Blackbook5/apps/StandaloneFull
Makefile, NONE, 1.1 TestBlackbookFullC.nc, NONE,
1.1 readme.txt, NONE, 1.1 TestBlackbookFullM.nc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list