How to recover from onApplicationConnectionFailed() - errorCode = 8, INTERNAL_ERROR? - google-cast

I have a network where spurious cast heartbeat failures occur. Sometimes this happens during the launch of the receiver application. Here is debug from my app:
08-28 21:38:53.308 10495-10495/com.bannerstonesoftware.XYZ D/CastedTournament﹕ onConnected()
08-28 21:38:53.471 10495-10495/com.bannerstonesoftware.XYZ D/CastedTournament﹕ onApplicationStatusChanged() - appStatus:
08-28 21:38:53.675 10495-10495/com.bannerstonesoftware.XYZ D/CastedTournament﹕ onApplicationStatusChanged() - appStatus:null
08-28 21:39:13.382 10495-10495/com.bannerstonesoftware.XYZ D/CastedTournament﹕ onConnectionSuspended(), cause = 2
08-28 21:39:13.383 10495-10495/com.bannerstonesoftware.XYZ D/CastedTournament﹕ onDisconnected()
08-28 21:39:13.384 10495-10495/com.bannerstonesoftware.XYZ D/CastedTournament﹕ onApplicationConnectionFailed() - errorCode:8
08-28 21:39:15.091 10495-10495/com.bannerstonesoftware.XYZ D/CastedTournament﹕ onConnectivityRecovered()
After seeing 'onConnectivityRecovered' I tried calling 'sendDataMessage()' on the DataCastManager, but get a 'NoConnectionException' from the CCL (I tried it both with and without first calling 'reconnectSessionIfPossible()'). The cast icon shows as being connected. If I choose to stop casting via the cast menu my cast receiver will still be shown on the TV. And, then on reconnection via the cast menu the application launch quickly completes.
Questions:
Why didn't the cast icon show as being unconnected after the receiver app failed to launch? Intended design?
If intended design should I simply turn around and call 'disconnectDevice()' on the DataCastManager?
Is it expected that onConnectivityRecovered() get called in this scenario?
Broadly speaking, what are my recovery options?

Related

How to properly parallelize JPA calls within Spring Data?

Context
This basically relates directly to this other question.
Essentially, our PUT endpoint needs to be more performant. Our approach is now to DELETE all relevant entries and then INSERT the new ones. This endpoint is only called once every few minutes, so there is no actual potential concurrent requests, but it does need to run fast.
I've already done other performance-related improvements like using JPQL for bulk queries, activating EclipseLink's batch-writing, and properly indexing the database.
At this point, the only other improvement I can think of is to run in parallel the calls which aren't related. Here is a screenshot of an execution of our endpoint as seen through Dynatrace PurePath:
Analysis
There are 9 calls to the DB which could be turned into 2 sets of calls:
All of the SELECT and DELETE calls could be started simultaneously and shouldn't step on each others' toes since they relate to different tables.
All of the INSERT calls could be started simultaneously and shouldn't step on each others' toes since they relate to different tables.
The 3x Update calls simply don't exist anymore so we can forget about them. Thus, it seems like this endpoint could potentially be twice as fast if this works as intended.
Difficulty
Although to be confirmed, it is my understanding that:
EntityManager is not thread-safe
A JDBC connection cannot be shared by multiple threads
Thus each thread needs to operate on a different connection
Thus, to allow rollback, those threads should wait until all requests are confirmed to be successful before committing after being done with their individual work
Additionally, #Async methods which return void are harder to control in terms of error handling
Question
How do we properly set up a Spring-MVC endpoint to issue database calls in different threads, and then use the returned CompletableFutures to get proper flow control by ensuring the queries ran successfully (i.e. completed without Exceptions).
The execution needs to be able to:
Await the first set of CompletableFutures completion before proceeding with the next set of requests
Allow rollback in case of error from any of the requests
Current state and problem
I'm trying to achieve this goal by using Spring's #Async, but I'm having trouble understanding how I should do this correctly.
The way I've done it currently throws a SQLTransientConnectionException after the 30s timeout configured for the HikariPool (which contains 8 threads):
javax.persistence.PersistenceException: java.lang.reflect.UndeclaredThrowableException
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:493)
at jdk.internal.reflect.GeneratedMethodAccessor236.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:406)
at com.sun.proxy.$Proxy280.getResultList(Unknown Source)
at org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:126)
at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:88)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:155)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:143)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:152)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:145)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy187.getAllSitesWithConcatenatedIds(Unknown Source)
...
Caused by: java.lang.reflect.UndeclaredThrowableException: null
at com.sun.proxy.$Proxy127.getConnection(Unknown Source)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:138)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:172)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:348)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:316)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.reconnect(DatasourceAccessor.java:583)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.reconnect(DatabaseAccessor.java:1665)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.incrementCallCount(DatasourceAccessor.java:323)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:622)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:567)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2099)
at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:603)
at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:265)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:275)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:261)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:332)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:744)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2759)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2712)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:584)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1232)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1191)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:485)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1279)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2983)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1898)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1880)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1845)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:262)
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:482)
... 127 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at jdk.internal.reflect.GeneratedMethodAccessor233.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.foo.datasource.SchemaBasedDataSourceInvocationHandler.invoke(SchemaBasedDataSourceInvocationHandler.java:27)
... 158 common frames omitted
Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30006ms.
at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:695)
at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:197)
at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:162)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128)
at com.foo.datasource.DataSourceSelector.getConnection(DataSourceSelector.java:64)
... 162 common frames omitted
It's also worth noting that Hikari also complains:
11:50:21.0800 - DEBUG TenantId[] UserId[] TraceId[] Thread[HikariPool-1 housekeeper]
Logger[com.zaxxer.hikari.pool.HikariPool]
Msg[HikariPool-1 - Pool stats (total=8, active=8, idle=0, waiting=1)]
11:50:21.0800 - DEBUG TenantId[] UserId[] TraceId[] Thread[HikariPool-1 housekeeper]
Logger[com.zaxxer.hikari.pool.HikariPool]
Msg[HikariPool-1 - Fill pool skipped, pool is at sufficient level.]
11:50:35.0582 - DEBUG TenantId[-1] UserId[] TraceId[] Thread[pool-6-thread-1]
Logger[com.zaxxer.hikari.pool.HikariPool]
Msg[HikariPool-1 - Timeout failure stats (total=8, active=8, idle=0, waiting=0)]
It seems pretty obvious that the spawned threads are having trouble managing the connections. They either aren't getting any, or are not releasing them back to the pool properly. (Although in any case, even if I fix this, I'm not entirely certain the whole "rollback everything if an error occurs" is achievable?)
Here is an attempt at abstracting the current code's state (CF are CompletableFuture, --> are calls to other classes, <-- are the returned type, ### is a blocking operation):
#RestController
--> #Service "Service 1"
--> #Transactional #Service "Service for First Select"
--> #Repository #Async "Table A"
<-- CF
<-- CF
<-- CF#thenApply
--> #Service "Service 1"
--> #Transactional #Service "Service for Second Select"
--> #Repository #Async "Table B"
<-- CF
<-- CF
<-- CF#thenApply
--> #Transactional #Service "Service 2"
--> #Repository #Async "Delete from Table X"
<-- void
--> #Repository #Async "Delete from Table Y"
<-- void
--> #Repository #Async "Delete from Table Z"
<-- void
### Need to wait for ALL (CF and void) of the previous #Async calls to be done
--> #Repository #Async "Insert into Table X"
<-- void
--> #Repository #Async "Insert into Table Y"
<-- void
--> #Repository #Async "Insert into Table Z"
<-- void
<-- void
Other relevant threads
I've read through these to get some insight:
https://stackoverflow.com/a/52177959/9768291
https://stackoverflow.com/a/24917195/9768291
https://stackoverflow.com/a/29349819/9768291
https://stackoverflow.com/a/47352233/9768291
https://dzone.com/articles/spring-async-and-transaction
https://dzone.com/articles/spring-transaction-management-over-multiple-thread-1

Android Studio - how to debug this situation?

Preface
I'm maintaining an app that I inherited from another team
Scenario
I understand ClassCastException but for the life of me I cannot find where this error is occurring in the code.
01-27 14:47:15.839 13272-13272/com.xx.android E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xx.android, PID: 13272
java.lang.ClassCastException: com.xx.viewmodels.components.AutoValue_SpecialViewModel cannot be cast to com.xx.viewmodels.components.NormalViewModel
at com.xx.android.viewholders.NormalViewHolder.bind(NormalViewHolder.java:27)
at com.xx.android.BaseAdapter.onBindViewHolder(BaseAdapter.java:39)
at com.xx.android.componentfeed.ComponentFeedAdapter.onBindViewHolder(ComponentFeedAdapter.java:123)
at com.xx.android.componentfeed.ComponentFeedAdapter.onBindViewHolder(ComponentFeedAdapter.java:79)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6541)
at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5484)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5750)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3436)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3988)
at android.view.View.layout(View.java:17938)
at android.view.ViewGroup.layout(ViewGroup.java:5814)
at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:611)
at android.view.View.layout(View.java:17938)
at android.view.ViewGroup.layout(ViewGroup.java:5814)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
at android.view.View.layout(View.java:17938)
at android.view.ViewGroup.layout(ViewGroup.java:5814)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742)
at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1731)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1496)
at android.view.View.layout(View.java:17938)
at android.view.ViewGroup.layout(ViewGroup.java:5814)
at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:132)
at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1361)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:874)
at android.view.View.layout(View.java:17938)
at android.view.ViewGroup.layout(ViewGroup.java:5814)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
at android.widget.FrameLayout.onLayout(FrameLayout.java:281)
at android.view.View.layout(View.java:17938)
at android.view.ViewGroup.layout(ViewGroup.java:5814)
at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1171)
at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:856)
at android.support.design.widget.ViewOffsetBehavior.layoutChild(ViewOffsetBehavior.java:63)
at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:136)
at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1361)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:874)
at andro
(I'm not sure why the output cutoff at that point)
NormalViewHolder.java
line 27
public class NormalViewHolder extends ComponentViewHolder<NormalViewModel> {
lines 55-64
public NormalViewHolder(final View itemView, final RecyclerView.RecycledViewPool relatedItemsViewPool) {
super(itemView);
Dagger.getInstance(itemView.getContext()).inject(this);
ButterKnife.bind(this, itemView);
adapter = new NormalRelatedItemsAdapter();
recyclerView.setRecycledViewPool(relatedItemsViewPool);
recyclerView.setAdapter(adapter);
recyclerView.setNestedScrollingEnabled(false);
}
Question
The app stops abruptly even with the settings found in my screenshot below. I've set breakpoints all around bind and onBindViewHolder and followed them as far as they go with no avail. How can I go about tracking down this issue? I was thinking I could move around in a breakpoint to put things together but I'm not having any luck.. Suggestions?
Extra
In researching the issue I've adjusted my breakpoint settings to the following with no success:
This was an impossible situation to debug.
This app was written to leverage dagger modules. In the app there was a line that referenced an incompatible class but in a file that was never even mentioned in the stack trace - making my methods of debugging rather useless.
Ultimately I had to go through line by line, manually inspecting every situation. Good old fashioned elbow grease.

frontend_tuner_status doesn't work in Python FEI

I'm using the Redhawk IDE 2.0.1 in Centos 6.5.
If I generate a Python based FEI, install, run, allocate, and then try to change the center_frequency via the Properties tab in the IDE I get the error:
Failed to update device property: Center Frequency
Error while executing callable. Caused by org.omg.CORBA.NO_IMPLEMENT: Server-side Exception: null vmcid: 0x41540000 minor code: 99 completed: No
Server-side Exception: null
I've tried to totally different systems and I get the same behavior.
If I do the same thing with the C++ project it works fine. Seems to me the auto generated Python code in 2.0.1 is broken like maybe it's not registering the listener? Any ideas are appreciated as this app will be much easier to implement in Python for me. Thanks
The error org.omg.CORBA.NO_IMPLEMENT: Server-side Exception is a CORBA exception indicating that the FEI device does not implement the setTunerCenterFrequency method, despite the FEI device having a DigitalTuner port. The DigitalTuner IDL inherits from the AnalogTuner IDL, which provides the setTunerCenterFrequency method. There must be a bug in the implementation of the FEI DigitalTuner port. In ${OSSIEHOME}/lib/python/frontend/input_ports.py, InDigitalTunerPort does not inherit from the InAnalogTunerPort, which is where the setCenterFrequency method lives. Changing it to the following should fix this issue:
class InDigitalTunerPort(FRONTEND__POA.DigitalTuner, InAnalogTunerPort):
def __init__(self, name, parent=digital_tuner_delegation()):
InAnalogTunerPort.__init__(self, name, parent)
There's a second issue as well. The generated base class instantiates the DigitalTuner port without passing in a reference to itself, the parent. The generated base class of your FEI Device should change from this:
self.port_DigitalTuner_in = frontend.InDigitalTunerPort("DigitalTuner_in")
to this:
self.port_DigitalTuner_in = frontend.InDigitalTunerPort("DigitalTuner_in", self)

OPOS_E_NOSERVICE after return from DllGetClassObject() in simple ATL COM OPOS Service Object

An example MSR OPOS Service Object I am writing was not initializing properly. I am adding this question to help others who run into the same problem since various searches resulted in no help whatsoever.
My question is: How can I determine what method in an OPOS Service Object is missing? Is there a utility of some kind that can exercise an OPOS Service Object and tell me what is missing? Is there some way to determine what methods an interface is expected to provide and which are missing?
I am following the procedure in Writing an OPOS Service Object using ATL in order to learn how an OPOS Service Object is created. I am using Visual Studio 2005 under Windows XP. To test the basic functionality I am using the NCR Retail Services Manager (RSM) utility to create a profile for an MSR in order to test the basic functionality of a Mag Stripe Reader simulator Service Object.
The Visual Studio project creates the COM object and registers it properly. When I attempt to use the Diagnostics function of RSM on the Service Object profile I receive an error of OPOS_E_NOSERVICE. I have created a log file logging function in the COM object which shows that the Service Object is loaded, the DLLMain() function of the COM object is invoked and the DLLGetClassObject() is invoked. However a second log file which logs the various Service Object interface methods is not created indicating that none of the Service Object interface methods are called.
So it appears that there is a problem with the Service Object interface which fails a check that is done at the time the COM object is loaded.
The DllGetClassObject() function is generated by the Visual Studio ATL project wizard and should require no changes.
Using the Microsoft POS .NET sample utility which comes with POS .NET 1.12 I tried using the sample utility. I can see the profile created with NCR RSM in the tree control under the MSR node. However when I attempt an Open there is an error message. The Windows Event log shows the follow error.
Microsoft.PointOfService.PosControlException: Method Open threw an
exception. The service object does not support one or more of the
methods required by its release.
I finally found the missing method from inspection and review of the code. It turns out that there was a single missing method, OpenService() which the Visual Studio 2005 ATL interface wizard had not created properly, possibly because it was the first method to be added to the interface for the Service Object.
When I attempted to add this method to the interface using the Visual Studio class wizard, the wizard issued an error message after I entered the method signature into the wizard dialog and pressed the Next button.
When retrying from scratch with a new ATL project, the error dialog had the following text:
Add/Remove operation is impossible, because the code element
'OpenServiceW' is read only.
While the method did show in the Visual Studio UI in the Class View when clicking on the method, the interface definition in the .idl file showed it as empty.
interface IVirtSo : IDispatch{
};
I closed Visual Studio then reopened the project and tried to add it again this time getting the error message:
Failed to return new Code Element. Possibly syntax error. New Element
Name: OpenService
Further investigation indicates that there is an OpenService() method in the Windows API and it may be that Visual Studio 2005 ran into a conflict between my trying to add this method to my Service Object and it existing in the Windows API (actual name appears to be OpenServiceW()).
What I finally ended up doing was to add an interface method with the same signature, named CheckService() using the class wizard and then changed the interface method name everywhere it existed in my generated code to OpenService() including a couple of places where CheckService was part of a name or label. For some reason the Visual Studio class wizard thought the interface method of OpenService() existed when in fact it did not.
However before I was able to do this successfully, I had to first exit Visual Studio then delete the Intellisense files (.ncb file and .suo file) so that adding new methods using the Class View wizard would work properly. Before deleting the files, the id number of the Add -> Method in the wizard kept incrementing even with the method add failing. After deleting the Intellisense file the id number started at 1 again and I was able to add the CheckService() method with the wizard and then modify the method name to OpenService() by hand using the Find tool with "Match case" turned on and "Match whole word" turned off.
The only way that I can see thus far is to review the OPOS Service Object specification against the source code implementation of the Service Object.
I am looking for other possible solutions to finding methods are missing from an OPOS Service Object.
From the article and my current experience, it appears that the following are the common subset of methods that need to be available in an OPOS Service Object in order for the Service Object to load properly. Some of these are invoked only once as a part of starting up and initialing the Service Object. Others, such as GetPropertyNumber() and GetPropertyString() as well as the SET versions of these may be invoked multiple times as part of setting up the Service Object environment. There may be other entry points offered by a particular OPOS Common Controls object for a particular device type that would need to have a corresponding method in the Service Object.
HRESULT OpenService(BSTR DeviceClass, BSTR DeviceName, IDispatch* pDispatch, [out, retval] long* pRC);
HRESULT CheckHealth(long Level, [out, retval] long* pRC);
HRESULT ClaimDevice(long ClaimTimeout, [out, retval] long* pRC);
HRESULT ClearInput([out, retval] long* pRC);
HRESULT CloseService([out, retval] long* pRC);
HRESULT COFreezeEvents(VARIANT_BOOL Freeze, [out, retval] long* pRC);
HRESULT DirectIO(long Command, [in, out] long* pData, [in, out] BSTR* pString, [out, retval] long* pRC);
HRESULT ReleaseDevice([out, retval] long* pRC);
HRESULT GetPropertyNumber(long PropIndex, [out, retval] long* pNumber);
HRESULT GetPropertyString(long PropIndex, [out, retval] BSTR* pString);
HRESULT SetPropertyNumber(long PropIndex, long Number);
HRESULT SetPropertyString(long PropIndex, BSTR PropString);

Allocation FRONTEND_Tuners on REDHAWK 1.10

I'm using RedHawk 1.10.0 on CentOS 6.5_x64.
I installed UHD 3.7.2.0 in order to try to employ USRP, B100 0r USRP1, both linked by usb connection, on this fantastic framework!
I built new node using GPP and USRP_UHD device and everything seems going well(GPP and USRP_UHD status are STARTED).
Therefore I tried to allocate FrontEnd Tuner from DeviceManager>USRP_UHD>FrontEnd Tuner>Allocate.
After I filled every fields and I pushed Finish.
Every parameter referred to USRP is correct, except for Your Allocation ID in which I have some doubts.
I got this message on my screen:
'The allocation request was not accepted because resources matching all aspects of the request were not available'
and I got this message on the console(level of console debug:TRACE):
2014-09-05 17:10:39 TRACE FrontendTunerDevice:369 - CORBA::Boolean frontend::FrontendTunerDevice<TunerStatusStructType>::allocateCapacity(const CF::Properties&) [with TunerStatusStructType = frontend_tuner_status_struct_struct]
2014-09-05 17:10:39 INFO FrontendTunerDevice:502 - allocateCapacity: NO AVAILABLE TUNER. Make sure that the device has an initialized frontend_tuner_status
2014-09-05 17:10:39 TRACE FrontendTunerDevice:578 - void frontend::FrontendTunerDevice<TunerStatusStructType>::deallocateCapacity(const CF::Properties&) [with TunerStatusStructType = frontend_tuner_status_struct_struct]
2014-09-05 17:10:39 DEBUG FrontendTunerDevice:603 - ALLOCATION_ID NOT FOUND: [dspcola:f096df16-0179-478a-a539-6605a96c17b9]
2014-09-05 17:10:39 DEBUG FrontendTunerDevice:637 - ERROR WHEN DEALLOCATING. SKIPPING...
Can some good man help me?
Thanks

Resources