Code conversion from 4.1.3 to 7.2 version

Hello,

I am new to Monkey C coding. Trying compile old version code to 7.2, Getting errors

for( var result = scanResults.next(); result != null; result = scanResults.next() ) {
            if( contains( result.getServiceUuids(), profileManager.PI_SERVICE ) )
            
Error            
descentmk2s: Cannot find symbol ':getServiceUuids' on type '$.Toybox.Lang.Object'.


item.setEnabled(state==1 ? true : false);
Error
descentmk2s: Cannot find symbol ':setEnabled' on type '$.Toybox.WatchUi.MenuItem'.

How to solve these 2 errors.

Thanks.

  • I know that code.  It's my BLE/Pi code....  It was written before type checking and with the latest SDK, typechecking is on by default.

    In the monkey.jungle file add

    project.typecheck=0

    and build again.

  • @jim_m_58 Great, worked smoothly. Nice meting with author.

  • How  to integrate CIQpi with OnTap and OnKey, to work with keyboard. From which class in CiQPi it can extends

    WatchUi.InputDelegate. New to C# and MonkeyC code.
    Thanks.
  • PiDelegate.mc handles both touch and buttons.  onSelect is used for both the upper right button on some devices, and a screen tap on others.

  • Actually want toadd WatchUI.TextPicker. So that, from the list, when 1 is pressed gpio1 goes on, similarly next one.

  • It might be clearer in PiGd I posted.  In the delegate, for onSelect, I call view.pushButton()

    pushButton is in the view, and what it does is send data to a characteristic on the pi, that handles opening/closing the garage door.  You can call pushButton() any way you want.  A menu, a button, etc.  

    I'd do something like have a characteristic to control things, and then write data to that characteristic as what to do.  So if you sent "18" as the data, it would turn GPIO 18 on.  Then maybe "-18" to turn GPIO 18 off.