Skip to content

Commit

Permalink
Fixes for milestone 1.7.2 release (issues 313). Updates to help
Browse files Browse the repository at this point in the history
document.
  • Loading branch information
Arunkumar-Karri committed Jan 9, 2013
1 parent 7fd55c8 commit c2c968f
Show file tree
Hide file tree
Showing 12 changed files with 200 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
<p>Unicode Release, Unicode Release MinSize are used with DMGraph project in BUSMASTER solution. Unicode Debug is not supported.</p>
<image href="../images/Build_Configurations.png"/>
</section>
<note>If build fails, select build solution another time without rebuild.</note>
</body>
</topic>
1 change: 1 addition & 0 deletions Documents/4 Help/topics/baudrate.dita
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
<image href="../images/Baudrate.bmp" placement="break"/>
<p>Other fields like BRP, Sampling Point, SJW and NBT are dependent on CNF0, CNF1 and CNF2 values. On clicking the &quot;OK&quot; button the controller will be initialized with the selected baud rate.</p>
<p>For more details on bit values of CNF0, CNF1 and CNF2 and the calculation of baud rate refer the section Bit Time Calculation.</p>
<note>For MH Tiny CAN, either Bit Rate or BTR will be considered. If Bit Rate value is available BTR will be discarded.</note>
</body>
</topic>
128 changes: 128 additions & 0 deletions Documents/4 Help/topics/com_interface_application.dita
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,133 @@ if(SUCCEEDED(hr))


</p>
<p>

</p>
<p>


To receive CAN messages from Busmaster makes use of the new interface_IAppEvents (connection points).</p>
<p>Provide implementation to sink class as shown below.</p>
<p><codeblock>Sink Class declaration:

VC++:

class ClientSink : public _IAppEvents
{
private:
DWORD m_dwRefCount;
public:
ClientSink();
virtual ~ClientSink();

STDMETHODIMP OnMessageReceived(CAN_MSGS RxMsg);

HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject);

ULONG STDMETHODCALLTYPE AddRef();

ULONG STDMETHODCALLTYPE Release();
};

C#:

class MyEventsSink : _IAppEvents
{
public MyEventsSink() { }

void _IAppEvents.OnMessageReceived(CAN_MSGS RxMsg)
{
MessageBox.Show(&quot;Rx Packet Received!&quot;);
}
}



Usage:

VC++:

HRESULT hResult = CoCreateInstance(CLSID_Application, NULL,
CLSCTX_LOCAL_SERVER, IID_IApplication, (void **) &amp;pICANvas);
if ((SUCCEEDED(hResult)) &amp;&amp; (NULL != pICANvas))
{
//check if this interface supports connectible objects
HRESULT hr = pICANvas-&gt;QueryInterface(IID_IConnectionPointContainer,(void **)&amp;m_pConnPtContainer);
if ( !SUCCEEDED(hr) )
{
return hr;
}

// find the specific connection point
hr = m_pConnPtContainer-&gt;FindConnectionPoint(IID__IAppEvents, &amp;m_pCntPoint);
if ( !SUCCEEDED(hr) )
{
return hr;
}

//we are done with the connection point container interface
m_pConnPtContainer-&gt;Release();

m_pSink = new ClientSink;
if ( NULL == m_pSink )
{
return E_FAIL;
}

//Get the pointer to CSink&apos;s IUnknown pointer
hr = m_pSink-&gt;QueryInterface (IID_IUnknown,(void **)&amp;m_pSinkUnk);
if ( !SUCCEEDED(hr) )
{
return hr;
}

// It is assumed that this should call the QueryInterface with _IAppEvents
// Do not understand why this calls the QueryInterface with IID_IMarshal
// Later this becomes reason for not getting event at ClientSink::OnMessageReceived
hr = m_pCntPoint-&gt;Advise(m_pSinkUnk, &amp;m_dwAdvise);
if ( !SUCCEEDED(hr) )
{
return hr;
}

UpdateGUI();
}
else
{
ASSERT(FALSE);
}


C#:

int cookie;
MyEventsSink mySink;
mySink = new MyEventsSink();

UCOMIConnectionPointContainer icpc = (UCOMIConnectionPointContainer)canMonitor;
UCOMIConnectionPoint icp;
Guid IID_IAppEvents = typeof(_IAppEvents).GUID;

icpc.FindConnectionPoint(ref IID_IAppEvents, out icp);
icp.Advise(mySink, out cookie);

canMonitor.Connect(1);
CAN_MonitorApp.CAN_MSGS sMsg = new CAN_MonitorApp.CAN_MSGS();
// Initialise message structure
sMsg.m_unMsgID = 100; // Message ID
sMsg.m_bEXTENDED = 0; // Standard Message type
sMsg.m_bRTR = 0; // Not RTR type
sMsg.m_ucDataLen = 8; // Length is 8 Bytes
sMsg.m_ucData = new Byte[8] { 0, 1, 2, 3, 4, 5, 6, 7 }; // Lower 4 Bytes
sMsg.m_ucChannel = 1; // First CAN channel

// Send the message
canMonitor.SendCANMSg(ref sMsg);
//canMonitor.

Thread.Sleep(5000);

icp.Unadvise(cookie);</codeblock></p>
</body>
</topic>
4 changes: 2 additions & 2 deletions Documents/4 Help/topics/node_simulation.dita
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
</metadata>
</prolog>
<body>
<p>Once the program is written it can be built as a DLL and loaded. The GCC compiler is used for this purpose. The GCC compiler is a freeware shipped along with the BUSMASTER tool. You can either build or build and load on the fly. You can also unload any loaded DLL. Once the DLL is loaded, all the handler function can be invoked/revoked selectively. Once the user program is loaded in to the BUSMASTER application handlers are exposed to the application.</p>
<p>Once the program is written it can be built as a DLL and loaded. The GCC compiler is used for this purpose. You can either build or build and load on the fly. You can also unload any loaded DLL. Once the DLL is loaded, all the handler function can be invoked/revoked selectively. Once the user program is loaded in to the BUSMASTER application handlers are exposed to the application.</p>
<section>
<title>Build</title>
<p>To make a build the program file should be associated with a node under a simulated system. (Refer section Simulated Systems) Selecting <uicontrol>Build All</uicontrol> from toolbar or <menucascade>
<uicontrol>Node Simulation</uicontrol>
<uicontrol>Build All</uicontrol>
</menucascade> will start building all the C files under all the simulated systems configured in that session. The building status will be displayed in the Output Window. If any errors found in the program, it will be listed with the line number. Double clicking the error line in the output window will open that particular file in Function editor and highlights the code in source window and will select the corresponding line in the Pane 2 (Refer section Function Editor) and makes the same editable in Pane 3. (Refer section Function Editor) If there is no error in the program, the DLLs will be generated and user will be notified of successful creation of DLLs. User can load these DLLs using <menucascade>
</menucascade> will start building all the C files under all the simulated systems configured in that session. The building status will be displayed in the Output Window. If any errors found in the program, it will be listed with the line number. Clicking the error line in the output window will open that particular file in Function editor and highlights the code in source window and will select the corresponding line in the Pane 2 (Refer section Function Editor) and makes the same editable in Pane 3. (Refer section Function Editor) If there is no error in the program, the DLLs will be generated and user will be notified of successful creation of DLLs. User can load these DLLs using <menucascade>
<uicontrol>Node Simulation</uicontrol>
<uicontrol>Load All</uicontrol>
</menucascade> menu.</p>
Expand Down
18 changes: 18 additions & 0 deletions Sources/Application/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
ON_COMMAND(IDM_SAVE_IMPORT, OnSaveImportDatabase)
ON_UPDATE_COMMAND_UI(IDM_SAVE_IMPORT, OnUpdateSaveImportDatabase)
ON_MESSAGE(WM_GET_DB_PTR, OnProvideMsgDBPtr)
ON_MESSAGE(WM_GET_MSG_NAME_FROM_CODE, OnProvideMsgNameFromCode)
ON_MESSAGE(WM_GET_PGN_NAME_FROM_CODE, OnProvidePGNNameFromCode)
ON_UPDATE_COMMAND_UI(IDM_CFGN_LOG, OnUpdateCfgnLog)
ON_COMMAND(ID_DISPLAY_MAIN, OnDisplayMain)
ON_UPDATE_COMMAND_UI(ID_DISPLAY_MAIN, OnUpdateDisplayMain)
Expand Down Expand Up @@ -12005,6 +12007,22 @@ LRESULT CMainFrame::OnProvideMsgDBPtr(WPARAM wParam, LPARAM /*lParam*/)
return 0;
}

LRESULT CMainFrame::OnProvideMsgNameFromCode(WPARAM wParam, LPARAM lParam)
{
CString* strMsgName = (CString*)lParam;
theApp.m_pouMsgSignal->bMessageNameFromMsgCode((UINT)wParam, *strMsgName);

return 0;
}

LRESULT CMainFrame::OnProvidePGNNameFromCode(WPARAM wParam, LPARAM lParam)
{
CString* strMsgName = (CString*)lParam;
m_pouMsgSigJ1939->bMessageNameFromMsgCode((UINT)wParam, *strMsgName);

return 0;
}

BOOL CMainFrame::bInitFrameProcCAN(void)
{
BOOL bReturn = FALSE;
Expand Down
2 changes: 2 additions & 0 deletions Sources/Application/MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,8 @@ class CMainFrame : public CMDIFrameWnd
afx_msg void OnUpdateSaveImportDatabase(CCmdUI* pCmdUI);
//To update the Message DB Pointer
afx_msg LRESULT OnProvideMsgDBPtr(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnProvideMsgNameFromCode(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnProvidePGNNameFromCode(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnMessageFromUserDll(WPARAM wParam, LPARAM lParam);
afx_msg void OnConfigureModeActive();
afx_msg void OnConfigurePassive();
Expand Down
21 changes: 11 additions & 10 deletions Sources/Application/RxMsgList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,20 +1113,21 @@ void CRxMsgList::vSetSortableMsgColumns(SMSGWNDHDRCOL& sHdrColStruct, ETYPE_BUS

if(eBusType == CAN) //If the BUS is CAN ,Set the Time field, Channel and ID fields as Sortable
{
m_pbSortableColumn[sHdrColStruct.m_byTimePos] = true;
m_pbSortableColumn[sHdrColStruct.m_byChannel] = true;
m_pbSortableColumn[sHdrColStruct.m_byIDPos] = true;
m_pbSortableColumn[sHdrColStruct.m_byTimePos] = true;
m_pbSortableColumn[sHdrColStruct.m_byChannel] = true;
m_pbSortableColumn[sHdrColStruct.m_byIDPos] = true;
m_pbSortableColumn[sHdrColStruct.m_byCodeNamePos] = true;
}
else if(eBusType == J1939)
//If the BUS is J1939,Set the Time field, Channel, CANID, PGN, Type, Src and Dest fields as Sortable
{
m_pbSortableColumn[sHdrColStruct.m_byTimePos] = true;
m_pbSortableColumn[sHdrColStruct.m_byChannel] = true;
m_pbSortableColumn[sHdrColStruct.m_byIDPos] = true;
m_pbSortableColumn[sHdrColStruct.m_byPGNPos] = true;
//m_pbSortableColumn[sHdrColStruct.m_byMsgTypePos]= true;
m_pbSortableColumn[sHdrColStruct.m_bySrcPos] = true;
m_pbSortableColumn[sHdrColStruct.m_byDestPos] = true;
m_pbSortableColumn[sHdrColStruct.m_byTimePos] = true;
m_pbSortableColumn[sHdrColStruct.m_byChannel] = true;
m_pbSortableColumn[sHdrColStruct.m_byIDPos] = true;
m_pbSortableColumn[sHdrColStruct.m_byPGNPos] = true;
m_pbSortableColumn[sHdrColStruct.m_bySrcPos] = true;
m_pbSortableColumn[sHdrColStruct.m_byDestPos] = true;
m_pbSortableColumn[sHdrColStruct.m_byCodeNamePos] = true;
}
}

Expand Down
2 changes: 2 additions & 0 deletions Sources/Application/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ enum
#define WM_UPDATE_MSG_INTRP_WND_PLC (WM_USER + 105)
#define WM_UPDATE_TREE_ITEMS_POS (WM_USER + 106)
#define WM_SHOW_MESSAGE_WINDOW (WM_USER + 107)
#define WM_GET_MSG_NAME_FROM_CODE (WM_USER + 108)
#define WM_GET_PGN_NAME_FROM_CODE (WM_USER + 109)


#define APPLICATION_NAME "BUSMASTER"
Expand Down
17 changes: 16 additions & 1 deletion Sources/DataTypes/J1939_DataTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "Include/Utils_Macro.h"
#include "J1939_DataTypes.h"
#include "application/hashdefines.h"
#include "application/Common.h"

int STJ1939_MSG::m_nSortField = 0;
int STJ1939_MSG::m_nMFactor = 1;
Expand Down Expand Up @@ -145,7 +146,7 @@ void tagSTJ1939_MSG::vSetSortAscending(bool bAscending)

int tagSTJ1939_MSG::DoCompareIndiv(const void* pEntry1, const void* pEntry2)
{
UINT Result = 0;
int Result = 0;

STJ1939_MSG* pJ1939Msg1 = (STJ1939_MSG*) pEntry1;
STJ1939_MSG* pJ1939Msg2 = (STJ1939_MSG*) pEntry2;
Expand All @@ -172,6 +173,20 @@ int tagSTJ1939_MSG::DoCompareIndiv(const void* pEntry1, const void* pEntry2)
break;
}
}
case 5: // Sort by message name
{
CString str1, str2;
AfxGetMainWnd()->SendMessage(WM_GET_PGN_NAME_FROM_CODE, (WPARAM)pJ1939Msg1->m_sMsgProperties.m_uExtendedID.m_s29BitId.unGetPGN(), (LPARAM)&str1);
AfxGetMainWnd()->SendMessage(WM_GET_PGN_NAME_FROM_CODE, (WPARAM)pJ1939Msg2->m_sMsgProperties.m_uExtendedID.m_s29BitId.unGetPGN(), (LPARAM)&str2);

Result = (int) (str1.CompareNoCase(str2));
Result *= m_nMFactor;

if (Result != 0)
{
break;
}
}
case 4: // Sort by PGN
{
Result = (UINT) (pJ1939Msg1->m_sMsgProperties.m_uExtendedID.m_s29BitId.unGetPGN() -
Expand Down
23 changes: 19 additions & 4 deletions Sources/DataTypes/Struct_BUS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "DataTypes_stdafx.h"
#include "include/Struct_CAN.h"
#include "application/hashdefines.h"
#include "application/Common.h"

int sTCANDATA::m_nSortField = 0;
int sTCANDATA::m_nMFactor = 1;
Expand All @@ -44,10 +45,15 @@ int sTCANDATA::DoCompareIndiv(const void* pEntry1, const void* pEntry2)

switch (m_nSortField)
{
case 3: // Sort by channel
{
Result = (int) (pDatCAN1->m_uDataInfo.m_sCANMsg.m_ucChannel - pDatCAN2->m_uDataInfo.m_sCANMsg.m_ucChannel);
Result *= m_nMFactor;
case 6: // Sort by message name
{
CString str1, str2;
AfxGetMainWnd()->SendMessage(WM_GET_MSG_NAME_FROM_CODE, (WPARAM)pDatCAN1->m_uDataInfo.m_sCANMsg.m_unMsgID, (LPARAM)&str1);
AfxGetMainWnd()->SendMessage(WM_GET_MSG_NAME_FROM_CODE, (WPARAM)pDatCAN2->m_uDataInfo.m_sCANMsg.m_unMsgID, (LPARAM)&str2);

Result = (int) (str1.CompareNoCase(str2));
Result *= m_nMFactor;

if (Result != 0)
{
break;
Expand All @@ -62,6 +68,15 @@ int sTCANDATA::DoCompareIndiv(const void* pEntry1, const void* pEntry2)
break;
}
}
case 3: // Sort by channel
{
Result = (int) (pDatCAN1->m_uDataInfo.m_sCANMsg.m_ucChannel - pDatCAN2->m_uDataInfo.m_sCANMsg.m_ucChannel);
Result *= m_nMFactor;
if (Result != 0)
{
break;
}
}
case 1: // Sort by time stamp
{
Result = (int) (pDatCAN1->m_lTickCount.QuadPart - pDatCAN2->m_lTickCount.QuadPart);
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit c2c968f

Please sign in to comment.